[erlang-questions] Ranch + SSL = crash during init:stop/0

e <>
Sun Jan 25 18:28:01 CET 2015

I have a well localized problem with Ranch that raises several basic 
questions about OTP, which i need to understand in order to solve the 

i have got the following applications running on a single isolated node:

1> application:which_applications().

[{online37,"My Application","0.1.0"},
  {cowboy,"Small, fast, modular HTTP server.","1.0.0"},
  {ssl,"Erlang/OTP SSL application","5.3.6"},
  {public_key,"Public key infrastructure","0.22.1"},
  {cowlib,"Support library for manipulating Web protocols.",
  {mnesia,"MNESIA  CXC 138 12","4.12.3"},
  {asn1,"The Erlang ASN1 compiler version 3.0.2","3.0.2"},
  {ranch,"Socket acceptor pool for TCP protocols.","1.0.0"},
  {stdlib,"ERTS  CXC 138 10","2.2"},
  {kernel,"ERTS  CXC 138 10","3.0.3"}]

Q1: does this list represent the starting order of these applications 

Q2: may i deduce from this list that 'ssl' will be stopped before 
'ranch'? (should be called init:stop/0)

the main problem is that during init:stop/0
'ranch' *DELIBERATELY* crashes with the reason: "socket closed"
(in src/ranch_acceptor.erl:28)
(which in my opinion most probably is caused by preliminary shut down of 

Q3: am i right in respect of 'ranch' that 'ssl' shall not be stopped 
before 'ranch'?

my .app.src file (which corresponds to the applications listing above) is:

{application, online37, [
	{description, "My Application"},
	{vsn, "0.1.0"},
	{modules, []},
	{registered, []},
	{applications, [
	{mod, {online37_app, []}},
	{env, []}

Q4: how could i affect the starting order of the applications? (provided 
i am using erlang.mk + relx)

More information about the erlang-questions mailing list