[我有两台服务器运行一个非常简单的Phoenix框架API,并且每隔一周左右,其中一台服务器会因出现此错误而异常运行并抛出502。
15:35:08.260 [error] 'File operation error: emfile. Target: /usr/lib/erlang/lib/stdlib-3.2/ebin/erl_posix_msg.beam. Function: get_file. Process: code_server.'
15:35:08.323 [error] 'File operation error: emfile. Target: erl_posix_msg.beam. Function: get_file. Process: code_server.'
15:35:08.324 [error] GenServer #PID<0.6569.17> terminating
** (UndefinedFunctionError) function :erl_posix_msg.message/1 is undefined (module :erl_posix_msg is not available)
(stdlib) :erl_posix_msg.message(:emfile)
(redix) lib/redix.ex:393: Redix.format_error/1
(redix) lib/redix/connection.ex:108: Redix.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: %Redix.Connection{backoff_current: nil, opts: [socket_opts: [], sync_connect: false, backoff_initial: 500, backoff_max: 30000, log: [disconnection: :error, failed_connection: :error, reconnection: :info], exit_on_disconnection: false, host: "redis.host.not", port: 6379], receiver: nil, shared_state: nil, socket: nil}
15:35:08.324 [error] Ranch protocol #PID<0.6568.17> (:cowboy_protocol) of listener Auth.Endpoint.HTTP terminated
** (exit) an exception was raised:
** (UndefinedFunctionError) function :erl_posix_msg.message/1 is undefined (module :erl_posix_msg is not available)
(stdlib) :erl_posix_msg.message(:emfile)
(redix) lib/redix.ex:393: Redix.format_error/1
(redix) lib/redix/connection.ex:108: Redix.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
如果我只是重新启动phoenix服务器,请重新启动。显然,这不是可扩展的解决方案,但是我正在努力诊断正在发生的事情。
任何帮助都会很甜蜜。
谢谢
阅读OTP erl_posix_msg模块,您可以看到它只是“太多打开文件”的代码。