[erlang-questions] spawn_link - zombie
Tue Jun 25 16:33:05 CEST 2013
Your parent process (<0.137.0>) is exiting normally, which doesn't cause linked processes to exit. If the final line in the parent was something like "exit(fail)", then I'd expect <0.138.0> to terminate as well. The error handling section in http://www.erlang.org/doc/reference_manual/processes.html describes this.
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Tuesday, 25 June 2013 at 16:26, tom kelly wrote:
> Hi List,
> I'm debugging a weird problem here on a customer site. We have an
> application that accepts tcp connections then kicks off a gen_server
> to implement some session logic, part of which is starting up a socket
> handler, which is also a gen_server, that provides a customised
> interface to the tcp connection. So after the init stage we have two
> linked processes.
> In my test environment both processes get tidied up correctly, when we
> get a tcp_closed from the connection or when we tell the session
> process to shut down. But on this customer site I'm seeing thousands
> of zombie socket_handlers, and they're causing us to hit a
> system_limit when we get new connections. I haven't managed to
> reproduce this state in my test environment yet but suspect it's
> happening in the init phase.
> Not sure if I've reproduced the cause of my problem here but I have
> this simple testcase that might help me if I can understand it. This
> spawns a process that spawns a process, if the parent process lives a
> while (comment in the 2nd sleep) then everything's as expected with
> two linked processes, with the parent linked to the shell process. But
> in this case if the parent terminates straight away the child will
> survive as an unlinked zombie, even though it was started with
> spawn_link, where I'd expect it to terminate too.
> Is this a bug or are my expectations incorrect? And any explanation
> much appreciated!
> 70> self().
> 71> spawn_link(fun() -> io:format("~n~nP1: ~p~n~n",[self()]),
> spawn_link(fun() -> io:format("~n~nP2:
> P1: <0.137.0>
> P2: <0.138.0>
> 72> process_info(erlang:list_to_pid("<0.137.0>"),links).
> 73> process_info(erlang:list_to_pid("<0.138.0>"),links).
> erlang-questions mailing list
> erlang-questions@REDACTED (mailto:erlang-questions@REDACTED)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions