[erlang-patches] fix process leak in ssh_system_sup (dynamicaly created childs where not cleaned up)

Niclas Eklund <>
Mon Sep 27 15:17:28 CEST 2010


Hello!

Yes it is. I've already fixed this and it will be released as soon as 
possible. But thanks for pointing this out :-)

Best regards,

Niclas @ Erlang/OTP

On Mon, 27 Sep 2010, Attila Rajmund Nohl wrote:

> Hello!
>
> The sub_subsystem function looks like this in the R14B sources:
>
> stop_subsystem(SystemSup, SubSys) ->
>    case lists:keyfind(SubSys, 2, supervisor:which_children(SystemSup)) of
>        false ->
>            {error, not_found};
>        {Id, _, _, _} ->
>            spawn(fun() -> supervisor:terminate_child(SystemSup, Id),
>                           supervisor:delete_child(SystemSup, Id) end),
>            ok;
>        {'EXIT', {noproc, _}} ->
>            %% Already terminated; probably shutting down.
>            ok;
>        {'EXIT', {shutdown, _}} ->
>            %% Already shutting down.
>            ok
>    end.
>
> I think a catch is missing from the case...
>
> 2010/9/2, Niclas Eklund <>:
>>
>> Hello!
>>
>> Thanks for reporting this! I've added your patch and it will be included
>> in R14B. I had to do some additional changes to avoid a race condition
>> between some processes.
>>
>> Best regards,
>>
>> Niclas @ Erlang/OTP
>>
>> On Wed, 1 Sep 2010, Stefan Grundmann wrote:
>>
>>> The ssh_system_sup supervisor supervises one ssh_subsystem_sup process for
>>> every client connection. There was no functionality to free resources
>>> (terminate_child/ delete_child) when a client connection was closed.
>>> Which lead to one ssh_subsystem_sup and one ssh_channel_sup process left
>>> over.
>>>
>>> This commit adds ssh_system_sup:stop_subsystem/2 and code that calls it
>>> in ssh_connection_manager:terminate/2.
>>>
>>> git fetch git://github.com/sg2342/otp.git fix_ssh_system_sup_proc_leak
>>>
>>> best regards
>>>
>>> Stefan Grundmann
>>>
>>> ________________________________________________________________
>>> erlang-patches (at) erlang.org mailing list.
>>> See http://www.erlang.org/faq.html
>>> To unsubscribe; mailto:
>>>
>>
>>
>>
>> ________________________________________________________________
>> erlang-patches (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:
>>
>>
>




More information about the erlang-patches mailing list