[erlang-patches] [PATCH] SSL error handling

Tamas.Cseke <>
Tue Nov 22 10:41:23 CET 2011


Hi,

We use tcp keepalive options with active mode and when a break network 
connection
the {ssl_closed, _} message is sen't to 'no_pid' makes the process crash
and the user module doesn't detect the failure.
I changed to send to the the correct pid.
Maybe other alert users could be changed too, but I can't reproduce 
those error cases.
Please review.

git fetch git://github.com/tcseke/otp.git sslfix

https://github.com/tcseke/otp/compare/sslfix
https://github.com/tcseke/otp/compare/sslfix.patch

Thanks,
Tamas

commit 849b81ffe6f66601997bff801c44b80a14f99152
Author: Tamas Cseke <>
Date:   Tue Nov 22 10:11:52 2011 +0100

     Fix SSL connection teardown handling.

     We detect network connection failures with TCP keepalive.
     After the connection goes down, the error messages is sent to 
'no_pid' that cause a badarg error.
     And the user module never doesn't detect the error.

         -define(SOL_TCP, 6).
         -define(TCP_KEEPIDLE, 4).
         -define(TCP_KEEPINTVL, 5).
         -define(TCP_KEEPCNT, 6).

         -define(KEEPALIVE_IDLE, 30).
         -define(KEEPALIVE_INTVL, 10).
         -define(KEEPALIVE_CNT, 5).

         ssl:setopts(Socket, [{raw, ?SOL_TCP, ?TCP_KEEPIDLE, 
<<?KEEPALIVE_IDLE:32/native>>},
                              {raw, ?SOL_TCP, ?TCP_KEEPINTVL, 
<<?KEEPALIVE_INTVL:32/native>>},
                              {raw, ?SOL_TCP, ?TCP_KEEPCNT, 
<<?KEEPALIVE_CNT:32/native>>}]).



More information about the erlang-patches mailing list