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

darrick darrickc at gmail.com
Thu Apr 24 22:00:19 CEST 2014


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.

-- 
darrickcoleman.com



More information about the SNMP4J mailing list