Closed julien6387 closed 1 year ago
There is a comment in ServerOptions.close_httpservers stating that:
# For unknown reasons, sometimes an http_channel
# dispatcher in the socket map related to servers
# remains open *during a reload*.
It might be related somehow.
I'm using Supervisor 4.2.4 and I have a use case where I can repeat the following failure almost 100% of the time when restarting Supervisor:
I suspect it happens when the HTTP socket is still under use when the
close()
is called on the socket. As long as there is a handle on the socket, the operating system will not actually deallocate the "closed" socket.Indeed, I am using a lot of
REMOTE_COMMUNICATION_EVENT
that make the HTTP socket a bit busy. When the Supervisor restart is called, the socket is most of the time not deallocated, although it has been closed. The restart being swift, the socket bind cannot reuse the port (still inTIME_WAIT
) and fails.The socket has to be shutdown before it's closed, so that the
FIN
event is sent to the peers. Then the socket close triggers the deallocation quite immediately. Once applied, I never had the issue again and it's good practice anyway.