RabbitMQ team reported an issue to me about Ranch getting stuck due to a receive with no timeout. We later identified the problem coming from SSL, specifically the ssl:controlling_process call when the SSL certfile/keyfile options are incorrect.
To reproduce the issue:
- First create an empty file named /tmp/empty_file
- Then run the following in an Erlang shell:
- You also need to connect,
should be enough
- Observe that the current stacktrace of the second process executing ssl:controlling_process is stuck in the gen:call forever
The problem seems to be missing function clauses when we have a call different from start and the state is not of the form
. When I added it my code continued executing fine, but the SSL application itself didn't stop. I tried to add another clause to handle the DOWN message as follows and that solved the issue entirely:
I'm sure this is not the 100% correct solution but that should be a good starting point for writing a proper patch. Thanks!