[99s-extend] Cowboy + SSL

e at bestmx.net e at bestmx.net
Mon Jan 26 15:30:56 CET 2015


> Hey, this is a known issue with recent Erlang versions:
> https://github.com/ninenines/ranch/issues/90

sorry i didn't know a keyword for googling this issue

well, it seems to me very interesting problem -- basically a dependency 
that appears in runtime (if i do not pass an ssl socket to the ranch, 
there will be no dependency).

i dare to suggest few alternative approaches to the solution:

(A) make the shutdown state distinguishable for the 'ranch_acceptor', so 
that not to crash in one particular sub case of the preliminary socket 
close. (a terrible STATEFUL solution, i do not dare to suggest how to 
pass this state to the acceptor)

(B) make it possible *in general* to pass additional dependencies to the 
applications that your application depends on. (as for now i can define 
in my .app.src any arbitrary deps for the "top" application, and then 
this .app.src will be processed anyway, there is no harm in improving 
this .app preparation procedure one step further, in order to affect 
.app files of subordinate applications. (it is perhaps a suggestion for 
relx devs, anyway, nobody forbid us to discuss it))

there are some alternative ways to achieve (B)

(B1)
it would be a mere change of the type of the 'applications' option in 
.app.src -- we may make it a tree instead of a list.
for example:

{applications, [
         kernel,
         stdlib,
         mnesia,
         {cowboy, [{ranch, [ssl]}]}
]}
%% which reads: my app requires all these,
%% and cowboy must require ranch and ranch must require ssl

it could (or should?) be shortened to:

(B2)
%% my app requires all these,
%% and *IF* 'ranch' is somehow required then it must require ssl
{applications, [
         kernel,
         stdlib,
         mnesia,
         cowboy,
	{ranch, [ssl]}
]}

this in turn makes separation possible:

(B3)
we specify all applications we require as a plain list, and then we 
specify PARTIAL ORDER: we need some certain pairs of applications to be 
started in certain sequences.

{applications, [
         kernel,
         stdlib,
         mnesia,
	ssl,
         cowboy
]},
{sequence, [
  	[ssl, ranch],
]}

%% which reads: my app requires those apps to start
%% and among these it requires the ssl to be started BEFORE ranch

%% generally we may specify any amount
%% of subsequences we care about:
{sequence, [
  	[ssl, ranch],
  	[ranch, cowboy_lib, cowboy],
  	[appA1, appA2, appA3, ...],
         ...
]}

of course the specified sequence MIGHT BE IMPOSSIBLE (self-refuting) and 
it needs to be verified, which is formally possible.


More information about the Extend mailing list