[erlang-questions] The node (with release using ssl) does not shut down after calling init:stop/0 in Erlang 17.3

Loïc Hoguin essen@REDACTED
Fri Oct 3 17:06:58 CEST 2014


On 10/02/2014 12:30 AM, Ingela Andin wrote:
> Hi!
> 2014-10-01 23:13 GMT+02:00 buddy <tauceti100@REDACTED
> <mailto:tauceti100@REDACTED>>:
>     It occurs the ssl listener socket now closes before the ranch
>     application is shutdown. Сan this behaviour be considered as normal?
> I am not so familiar with the ranch application, but as the ranch
> application uses the ssl application it sounds normal that a ssl listen
> socket can be closed before the ranch application has finished its
> shutdown.  Timing of  events of course can change between releases or
> platforms running the same release.

It is not normal and there should be no timing issue involved.

The processes are like this:

supervisor owns the listening socket
   |-> children do the accept

When the application is stopped, the children are killed with 
brutal_kill by the supervisor, which then proceeds to end (and thus 
closes the listening socket).

So this is not a timing issue as the termination order does not allow 
for this scenario, or at least not one where the application closes the 
socket before the children who accept connections.

On the other hand the supervisor has a terminate value set to infinity 
(the recommended for supervisors) so this might be part of the reason 
why it ends up causing errors/not stopping the VM, and could be 
unrelated to SSL (though it apparently only happens with SSL listeners 
from what I understand). Something else could prevent the application 
from stopping properly.

A ticket has been open on the Ranch tracker so I will investigate 
further when I get the time.

Loïc Hoguin

More information about the erlang-questions mailing list