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

Stefan Grundmann <>
Mon Nov 7 17:28:31 CET 2011

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 
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} = 
        deactivated -> ok
-    State#state{timeout = false};
+    State#state{active = false};
 deactivate_timer(State) ->

Regression test:

git fetch git://github.com/sg2342/otp.git snmp_note_store_timer-tc

best regards

Stefan Grundmann

More information about the erlang-patches mailing list