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

Henrik Nord henrik@REDACTED
Thu Jan 19 16:29:58 CET 2012


Hi

This fails on Linux 2.6.27.54-0.2-default, SLES 11-0 (x86_64)


notes memory (not empty): 560

wait 3 times the GC timeout

*** [2012:01:16 05:00:59 4721] SNMP A-NOTE-STORE DEBUG ***
    timeout

*** [2012:01:16 05:01:00 4229] SNMP A-NOTE-STORE DEBUG ***
    timeout

*** [2012:01:16 05:01:00 4725] SNMP A-NOTE-STORE LOG ***
    info

notes memory (after GC): 339

verify notes db memory

*** [2012:01:16 05:01:00 4726] SNMP A-NOTE-STORE DEBUG ***
    terminate: {#Ref<0.0.0.98467>,2515150,
                {'EXIT',
                    {{badmatch,300},
                     [{snmp_note_store_test,gc_timer,1,
                          [{file,"snmp_note_store_test.erl"},{line,288}]},
                      {test_server,ts_tc,3,
                          [{file,"test_server.erl"},{line,1635}]},
                      {test_server,run_test_case_eval1,6,
                          [{file,"test_server.erl"},{line,1182}]},
                      {test_server,run_test_case_eval,9,
                          [{file,"test_server.erl"},{line,1123}]}]}},
                [{snmp_note_store_test,gc_timer,288},
                 {test_server,ts_tc,1635},
                 {test_server,run_test_case_eval1,1182},
                 {test_server,run_test_case_eval,1123}],
                []}



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

-- 
/Henrik Nord Erlang/OTP




More information about the erlang-patches mailing list