Ssl_closed error in GenServer

Hey all, I have an app running on elixir 1.8, Erlang 21 and Phoenix 1.3. It’s basically a dashboard which calls to different servers and gets some information from them, everything through a gen server. It’s been working well for at least a year, but now suddenly the application is breaking quite often and in the logs I can see the following error:
** (FunctionClauseError) no function clause matching in Dashboard.StatusServer.handle_info/2
Last message: {:ssl_closed, {:sslsocket, {:gen_tcp, #Port<0.122>, :tls_connection, :undefined}, [#PID<0.644.0>, #PID<0.643.0>]}}
(stdlib) gen_server.erl:637: :gen_server.try_dispatch/4 (stdlib) gen_server.erl:711: :gen_server.handle_msg/6 (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

I’ve been googling and thought it could be an issue with the HttpPoison version, I updated to the latest version (1.4) but I’m still having the same issue.

Do you have an idea what could be happening?


1 Like

Well, the main reason it’s failing is that it’s getting a message that it doesn’t have a pattern for. You could solve this by adding:

def handle_info({:ssl_closed, _}, state) do
  {:noreply, state}

The question remains of course why you’re getting that message. I’m not totally sure.

In case anybody gets here in the future, the issue seems to be due to hackney leaking messages: