[erlang-questions] gen_server not unregistering [20.1]

Brujo Benavides elbrujohalcon@REDACTED
Wed Mar 7 13:52:43 CET 2018


Not sure if this will help at all, but try trapping exits in that gen_server (i.e. process_flag(trap_exit, true).) since terminate might not be evaluated unless you’re trapping exits. Ref: http://erlang.org/doc/man/gen_server.html#Module:terminate-2 <http://erlang.org/doc/man/gen_server.html#Module:terminate-2>

Good luck!

Brujo Benavides <http://about.me/elbrujohalcon>



> On 7 Mar 2018, at 09:48, Heinrich Venter <hfventer@REDACTED> wrote:
> 
> Hi all
> 
> I have been experiencing the strangest thing.
> 
> I am using an application (gen_rpc) that internally uses a gen_server to manage a gen_tcp outgoing socket.
> 
> On closing of the socket form the server side, the message {tcp_closed, Socket} is received in the handle_info. This handle_info returns {stop, normal, State}
> BUT
> The gen_server does not actually terminate. It does not call terminate and the PID remains registered locally. It actually keeps on processing messages which leads to badtcp reponses when it tires to send on the failed socket.
> 
> Has any one seen something remotely like this, or have any suggestions of how to proceed?
> 
> Links
> https://github.com/priestjim/gen_rpc <https://github.com/priestjim/gen_rpc>
> 
> 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180307/266cd836/attachment.htm>


More information about the erlang-questions mailing list