[erlang-bugs] snmpa_mib_data_tttn.erl hangs

Alex Hudich alttagil@REDACTED
Mon Feb 6 23:39:25 CET 2017


Hi!

I was wondering why simple erlang program hangs and consumes a lot of memory when it starts agent with simpliest MIB file:


JSM-MIB DEFINITIONS ::= BEGIN
          IMPORTS
	      OBJECT-TYPE    FROM RFC-1212
	      experimental   FROM RFC1155-SMI
	      ;
 
	  jsm		OBJECT IDENTIFIER ::= { experimental 17780513 }

	  jsmName OBJECT-TYPE
              SYNTAX  OCTET STRING (SIZE (0..255))
              ACCESS  read-only
              STATUS  mandatory
              DESCRIPTION «Description»
              ::= { jsm 1 }
END


So I've found that in snmpa_mib_data_tttn.erl function integrate_indexes creates a huge list of undefined_nodes atoms before it could insert MIB data at 17780513 position!


integrate_indexes(CurIndex, [{CurIndex, Data} | T]) ->
    [Data | integrate_indexes(CurIndex + 1, T)];
integrate_indexes(_Index, []) ->
    [];
integrate_indexes(CurIndex, L) ->
    [undefined_node | integrate_indexes(CurIndex + 1, L)].


Why not use maps for the purpose of indexing and just skip unset positions?


Alexander Hudich
@alttagil 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20170207/efd5d24a/attachment.htm>


More information about the erlang-bugs mailing list