我有两个服务器运行一个非常简单的凤凰框架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 Server,Boom,一切都会再次工作。显然,这不是一个可扩展的解决方案,但我正在努力诊断发生的事情。
任何帮助都会很甜蜜。
谢谢
阅读otp erl_posix_msg模块您可以看到它是"太多的打开文件"的代码。
message_1(emfile) -> <<"too many open files">>;