[erlang-patches] [PATCH] fix EST leak in snmp_note_store

Henrik Nord henrik@REDACTED
Tue Nov 8 12:12:15 CET 2011


On 11/07/2011 05:28 PM, Stefan Grundmann wrote:
> fix GC timer in snmp_note_store
>
> in deactivate_timer/1 the new state of the timer is not set correctly,
> instead the timeout value set to 'false', resulting in a "crash loop"
> when the snmp note store process tries to restart the timer process.
>
> the incorrect activation state also leads to an ETS memory leak:
> an expired note will not get deleted except when
> snmp_note_store:get_note/2 is called with its key - the GC mechanism
> does not work because a deactivated timer will never be activated again.
>
> Commit that corrects this issue:
>
> git fetch git://github.com/sg2342/otp.git fix-snmp_note_store_timer
>
> Inline diff:
>
> diff --git a/lib/snmp/src/misc/snmp_note_store.erl
> b/lib/snmp/src/misc/snmp_note
> index a21a620..5bb5cb4 100644
> --- a/lib/snmp/src/misc/snmp_note_store.erl
> +++ b/lib/snmp/src/misc/snmp_note_store.erl
> @@ -282,7 +282,7 @@ deactivate_timer(#state{timer = Pid, active = true} =
> State)
>       receive
>          deactivated ->  ok
>       end,
> -    State#state{timeout = false};
> +    State#state{active = false};
>   deactivate_timer(State) ->
>       State.
>
>
> Regression test:
>
> git fetch git://github.com/sg2342/otp.git snmp_note_store_timer-tc
>
> best regards
>
> Stefan Grundmann
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches
Thank you for your contribution!
included the revised branch into 'pu'

-- 
/Henrik Nord Erlang/OTP




More information about the erlang-patches mailing list