[erlang-questions] SSL/TLS renegotiation crash triggered by setopts

Florian Waas <>
Wed Aug 7 18:34:16 CEST 2013


Ingela,
Thanks for the quick response -- will use my "provisional" fix for the
time being!

-fl.

On Wed, Aug 7, 2013 at 3:04 AM, Ingela Andin <> wrote:
> Hi!
>
> I think you found a bug setopts should indeed not change the state, but if
> you happen to be in a renegotiation you could get a handshake packet that
> changes the state, as active is an emulated option and the fsm-process
> internally uses active once.  We will fix this for the next release.
>
>
> Regards Ingela Erlang/OTP team - Ericsson AB
>
>
> On Wed, Aug 7, 2013 at 8:15 AM, Florian Waas <> wrote:
>>
>> Hi,
>> Reading from a Postgres server tls_connection's gen_fsm crashes on me
>> during TLS renegotiation with below error report (small snippet of
>> most relevant parts only due to size).
>>
>> I'm setting the socket into {active, once} after each packet; the
>> server kicks off renegotiation every 512MB. Looks like the problem
>> occurs when setopts is called during renegotiation. When hammering the
>> system I hit it pretty much every time the server renegotiates --
>> happens in both R15 and R16.
>>
>> Quick hack in tls_connection.erl:995 to allow the transition from
>> 'connection' to 'hello' in handle_sync_event instead of insisting that
>> setopts doesn't change states gets me out of this pickle...
>>
>>
>> Anybody seen this problem? Clean(er) workarounds available?
>>
>> Thanks,
>> -fl.
>>
>>
>>
>>
>> =ERROR REPORT==== 6-Aug-2013::21:26:38 ===
>> ** State machine <0.368.0> terminating
>> ** Last message in was {'$gen_sync_all_state_event',
>>                            {<0.364.0>,#Ref<0.0.0.67905>},
>>                            {set_opts,[{active,once}]}}
>> ** When State == connection
>> **      Data  == {state,client,
>>                      {#Ref<0.0.0.247>,<0.364.0>},
>> [...]
>>                      undefined,
>>                      {[],[]},
>>                      false,true,false,undefined,undefined}
>> ** Reason for termination =
>> ** {{case_clause,
>>         {next_state,hello,
>>             {state,client,
>> [...]
>>
>>     [{tls_connection,handle_sync_event,4,
>>          [{file,"tls_connection.erl"},{line,994}]},
>>      {gen_fsm,handle_msg,7,[{file,"gen_fsm.erl"},{line,505}]},
>>      {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>


More information about the erlang-questions mailing list