You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by j3rem1e <je...@gmail.com> on 2015/07/28 13:13:27 UTC

Random NPE in ManagedBrokerRegion.addConnection with OSGI

Hi,

I am using ActiveMQ v5.11.1 with 'activemq-osgi' in Karaf v2.4. ActiveMQ is
embedded, and clients use the vm connector.

Randomly, i see logged NPE in the method
ManagedBrokerRegion.addConnection(). When this issue happen, the container
can't be recovered, and
i should kill and restart Karaf (because of "Already connected" exceptions).
I can easily reproduce this issue with the help of a debugger :

1/ The BrokerService register itself before been completely started
2/ The vm connector wait for a broker to be registered, and then register a
connection to it

There is a race condition between 1 and 2 : if 1 is slow, then 2 fail with a
NPE. Adding a breakpoint line 604 in BrokerService can help to reproduce
this NPE ([1])

This issue is the same as AMQ-5161, but i can't start the broker
synchronously : activemq-osgi start the broker with ConfigurationAdmin,
which is asynchronous.
I tryed adding useJmx="false" in the configuration of the broker : i worked
more or less. I still have errors [2], but thoses errors were recoverable
(after some times,
the connection were successfully refreshed).

is there a fix planned for AMQ-5161 ? Or how can i handle this asynchronous
behavior with activemq-osgi ?
Thanks !

Jeremie

---


[1] BrokerService.java (start) :

// in jvm master slave, lets not publish over existing broker till we get
the lock
final BrokerRegistry brokerRegistry = BrokerRegistry.getInstance();
if (brokerRegistry.lookup(getBrokerName()) == null) {
	brokerRegistry.bind(getBrokerName(), BrokerService.this); // <-- The bug
seem to be here
}
startPersistenceAdapter(startAsync); // <-- breakpoint here
startBroker(startAsync);
brokerRegistry.bind(getBrokerName(), BrokerService.this);

[2]
Caused by: javax.jms.JMSException: PageFile is not loaded
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54)[113:org.apache.activemq.activemq-osgi:5.10.1]
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1417)[113:org.apache.activemq.activemq-osgi:5.10.1]
        at
org.apache.activemq.ActiveMQSession.syncSendPacket(ActiveMQSession.java:2018)[113:org.apache.activemq.activemq-osgi:5.10.1]
        at
org.apache.activemq.ActiveMQMessageProducer.<init>(ActiveMQMessageProducer.java:124)[113:org.apache.activemq.activemq-osgi:5.10.1]
        at
org.apache.activemq.ActiveMQSession.createProducer(ActiveMQSession.java:1048)[113:org.apache.activemq.activemq-osgi:5.10.1]
        at
org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.getCachedProducer(CachingConnectionFactory.java:364)[82:org.apache.servicemix.bundles.spring-jms:3.2.9.RELEASE_1]
        at
org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:322)[82:org.apache.servicemix.bundles.spring-jms:3.2.9.RELEASE_1]
        at com.sun.proxy.$Proxy625.createProducer(Unknown
Source)[82:org.apache.servicemix.bundles.spring-jms:3.2.9.RELEASE_1]
        at
org.springframework.jms.core.JmsTemplate.doCreateProducer(JmsTemplate.java:971)[82:org.apache.servicemix.bundles.spring-jms:3.2.9.RELEASE_1]
        at
org.springframework.jms.core.JmsTemplate.createProducer(JmsTemplate.java:952)[82:org.apache.servicemix.bundles.spring-jms:3.2.9.RELEASE_1]
        at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:271)[140:org.apache.camel.camel-jms:2.14.1]
        at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:217)[140:org.apache.camel.camel-jms:2.14.1]
        at
org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$1.doInJms(JmsConfiguration.java:231)[140:org.apache.camel.camel-jms:2.14.1]
        at
org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)[82:org.apache.servicemix.bundles.spring-jms:3.2.9.RELEASE_1]




--
View this message in context: http://activemq.2283324.n4.nabble.com/Random-NPE-in-ManagedBrokerRegion-addConnection-with-OSGI-tp4699980.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Random NPE in ManagedBrokerRegion.addConnection with OSGI

Posted by j3rem1e <je...@gmail.com>.
Ok, it's my fault :-)
I thought i was using v5.11.1, but in fact, it was v5.10.1

I could reproduce this issue with a standalone unit test : fail in v5.10.1
but succeeded in v5.11.1. It was caused by VMTransportFactory.lookupBroker,
line 183 :

"if (broker == null && waitForStart > 0) {"
instead of
"if (broker == null || waitForStart > 0) {"

it's fixed in v5.11.1 with AMQ-5086 (but JIRA is wrong, it's not fixed in
5.10.1 ?).




--
View this message in context: http://activemq.2283324.n4.nabble.com/Random-NPE-in-ManagedBrokerRegion-addConnection-with-OSGI-tp4699980p4700002.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.