[erlang-questions] simple_one_for_one supervisor - what happens at restart? (also: gen_tcp)

Oliver Korpilla Oliver.Korpilla@REDACTED
Fri May 13 15:25:14 CEST 2016


Hello.

I have transient workers under a simple_one_for_one supervisor. I start them dynamically through start_child/2.

How exactly do these get restarted? With the same parameter list I supplied when first starting them?

Concrete example:

I have a central process listening to a TCP port, then accepting a connection, creating a worker for it through a supervisor, and then using gen_tcp:controlling_process/2 to transfer control of that new socket to the worker. The worker starts with one parameter: the socket. 

Now lets say the worker crashes on unexpected input and gets restarted. Is the socket now closed? Will the same socket again be provided to the process on restart?

Thanks,
Oliver



More information about the erlang-questions mailing list