[SNMP4J] Stackoverflow in activemq when snmp4j configures a BasicConfigurator in log4j

Frank Fock fock at agentpp.com
Thu Apr 24 22:07:40 CEST 2014


Hi,

There is probably a recursion from the Log4J initialization that calls
your code with SnmpRequest.
The SnmpRequest class is an example only and should NOT be used
in production code.

Best regards,
Frank

Am 24.04.2014 22:00, schrieb darrick:
> This is a really bizarre issue. I'm trying to upgrade snmp4j to the latest
> version (2.2.5) from 1.10.1 and now I'm getting a stackoverflowerror from
> within ActiveMQ (version 5.9.1). I have a bizarre work-around but it'd be
> interesting if anyone could shed more light on the issue.
>
> The stackoverflow happens when snmp4j loads the SnmpRequest class and
> executes this static block:
>
> static {
>      LogFactory.setLogFactory(new Log4jLogFactory());
>      org.apache.log4j.BasicConfigurator.configure();
>      BER.setCheckSequenceLength(false);
>    }
>
> ActiveMQ blows up when the BasicConfigurator.configure() call is made. My
> work-around hack is to construct (load) an SnmpRequest object at startup
> (before ActiveMQ, and log4j gets initialized). In snmp4j version 1.10.1 the
> SnmpRequest class has a different static block without the configure() call.
>
> Below is the trace for the stackoverflowerror:
>
> 6688 [ActiveMQ VMTransport: vm://Server#1-1] SYSTM SystemError  -
> 4550 [ActiveMQ VMTransport: vm://Server#1-1] TRACE org
> 6689 [ActiveMQ VMTransport: vm://Server#1-1] SYSTM SystemError  -
> 4550 [ActiveMQ VMTransport: vm://Server#1-1] TRACE org
> 6691 [ActiveMQ VMTransport: vm://Server#1-1] SYSTM SystemError  -
> 4550 [ActiveMQ VMTransport: vm://JServer#1-1] TRACE org
> 6693 [ActiveMQ VMTransport: vm://Server#1-1] SYSTM SystemError  -
> 4550 [ActiveMQ VMTransport: vm://Server#1-1]
>
> This is going to stderr I believe, and it's all one big line.
>

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231




More information about the SNMP4J mailing list