[erlang-bugs] ssl_manager:invalidate_session issues

Ferenc Holzhauser ferenc.holzhauser@REDACTED
Fri May 27 15:03:26 CEST 2011


Hi,

After upgrading to R14B03 I got these errors:

=ERROR REPORT==== 27-May-2011::13:48:25 ===
Error in process <0.10933.0> on node 'mynodename' with exit value:
{undef,[{ssl_session_cache,delete,[{{"remotehost",995},<<32 bytes>>}]}]}



The problem seems to be this recently modified part of the ssl_manager:

handle_cast({invalidate_session, Host, Port,
    #session{session_id = ID} = Session},
   #state{session_cache = Cache,
  session_cache_cb = CacheCb} = State) ->
    CacheCb:update(Cache, {{Host, Port}, ID}, Session#session{is_resumable =
false}),
>>> timer:apply_after(?CLEAN_SESSION_DB, CacheCb, delete, [{{Host, Port},
ID}]), <<<
    {noreply, State};

handle_cast({invalidate_session, Port, #session{session_id = ID} = Session},
   #state{session_cache = Cache,
  session_cache_cb = CacheCb} = State) ->
    CacheCb:update(Cache, {Port, ID}, Session#session{is_resumable =
false}),
>>> timer:apply_after(?CLEAN_SESSION_DB, CacheCb, delete, [{Port, ID}]), <<<
    {noreply, State};


One issue is a typo : missing the Cache from the arguments expected in
ssl_session_cache:delete(Cache,Key)
Other one is the timer:appy which creates a new timer process and would fail
to access the protected table from it

This fix works in my environment:

handle_cast({invalidate_session, Host, Port,
         #session{session_id = ID} = Session},
        #state{session_cache = Cache,
           session_cache_cb = CacheCb} = State) ->
    CacheCb:update(Cache, {{Host, Port}, ID}, Session#session{is_resumable =
false}),
    timer:send_after(?CLEAN_SESSION_DB, self(), {delayed_clean_session,
{{Host, Port}, ID}}),
    {noreply, State};

handle_cast({invalidate_session, Port, #session{session_id = ID} = Session},
        #state{session_cache = Cache,
           session_cache_cb = CacheCb} = State) ->
    CacheCb:update(Cache, {Port, ID}, Session#session{is_resumable =
false}),
    timer:send_after(?CLEAN_SESSION_DB, self(), {delayed_clean_session,
{Port, ID}}),
    {noreply, State};



%% additional handle_info for delayed session cleaning
handle_info({delayed_clean_session, Key}, #state{session_cache = Cache,
                    session_cache_cb = CacheCb
                    } = State) ->
    CacheCb:delete(Cache, Key),
    {noreply, State};


Kind Regards,
Ferenc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20110527/8e6aed19/attachment.htm>


More information about the erlang-bugs mailing list