[erlang-questions] Node Crash for inets config 'SocketType ssl'

Prakash Parmar prakash.parmar@REDACTED
Tue Jul 10 08:21:05 CEST 2018


Hello,


I have a web-server based on inets otp application and running completely fine over 'http' in order to support 'https' I have changed inets configuration

as per the sample configuration located at Erlang's repo [1].


Here are the config file snippet I had changed/added,

...
SocketType ssl
SSLCertificateFile      {{install_dir}}/config/www/certs/server.pem
SSLCertificateKeyFile   {{install_dir}}/config/www/certs/server.pem
SSLVerifyClient 0
...


I have also generated certificate files[2] and kept it in above mentioned path.

unfortunately node is crashing at startup and following logs is printed on shell.

=CRASH REPORT==== 9-Jul-2018::12:13:50 ===
  crasher:
    initial call: application_master:init/4
    pid: <0.902.0>
    registered_name: []
    exception exit: {{shutdown,
                      {failed_to_start_child,httpd_sup,
                       {shutdown,
                        {failed_to_start_child,
                         {httpd_instance_sup,any,8881,default},
                         {shutdown,
                          {failed_to_start_child,
                           {httpd_acceptor_sup,any,8881,default},
                           {shutdown,
                            {failed_to_start_child,
                             {httpd_acceptor_sup,any,8881,default},
                             {'EXIT',
                              {function_clause,
                               [{http_transport,start,
                                 [ssl],
                                 [{file,"http_transport.erl"},{line,54}]},
                                {httpd_acceptor,do_socket_start,1,
                                 [{file,"httpd_acceptor.erl"},{line,101}]},
                                {httpd_acceptor,do_init,4,
                                 [{file,"httpd_acceptor.erl"},{line,94}]},
                                {httpd_acceptor,acceptor_init,8,
                                 [{file,"httpd_acceptor.erl"},{line,82}]},
                                {proc_lib,init_p_do_apply,3,
                                 [{file,"proc_lib.erl"},
                                  {line,247}]}]}}}}}}}}}},
                     {inets_app,start,[normal,[]]}}
      in function  application_master:init/4 (application_master.erl, line 134)
    ancestors: [<0.901.0>]
    messages: [{'EXIT',<0.903.0>,normal}]
    links: [<0.901.0>,<0.739.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 987
    stack_size: 27
    reductions: 166
  neighbours:




Does anyone know what might be the problem ?

I have looked into 'http_transport' module's code and it seems that start/1 function[3] is not accepting 'ssl' atom as an arity,
Arity for this function is like {ssl, <Certificate_file_path>}. Any idea on this ? Did I missed anything ?

/ cheers,
Prakash Parmar



Reference,
[1] https://github.com/erlang/otp/blob/master/lib/inets/examples/server_root/conf/ssl.conf
     https://github.com/erlang/otp/blob/master/lib/inets/examples/server_root/conf/httpd.conf

[2] https://devcenter.heroku.com/articles/ssl-certificate-self
     https://stackoverflow.com/questions/991758/how-to-get-pem-file-from-key-and-crt-files

[3] https://github.com/erlang/otp/blob/177a3470d598c892e0b7251cd2d9219aebcd3747/lib/inets/src/http_lib/http_transport.erl#L54



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180710/13f7fc6d/attachment.htm>


More information about the erlang-questions mailing list