activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathaniel Mar (JIRA)" <>
Subject [jira] [Commented] (AMQ-5161) NullPointerException during async startup
Date Sun, 11 May 2014 09:10:15 GMT


Nathaniel Mar commented on AMQ-5161:

I'm brand new to ActiveMQ, but am interested in contributing, so I decided to take a stab
at this ticket.

It seems that there may be a bit of a race condition when using the async start option on
an embedded broker. I ran the provided unit test, and noticed that the NPE did not appear
when I added a short delay between starting the broker and then initiating the connection
to the broker. Specifically, what happens is that the main thread attempts to connect to the
broker before the broker start up thread has completed (i.e. the broker has set its broker
service instance).

I haven't diffed the 5.9 and 5.9.1 versions so I'm not sure what could have caused this to
become a new issue.

As mentioned, I don't know much about the internal workings of ActiveMQ. However, as a suggestion,
if the above is an accurate explanation of this issue, perhaps one possible fix would be to
the TransportConnection class to wait until the broker has fully started to initiate the connection
-- something along the lines of adding a "while (!broker.getBrokerService().isStarted()) "
with that method already provided by the library.

Any thoughts?

> NullPointerException during async startup
> -----------------------------------------
>                 Key: AMQ-5161
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.9.1
>            Reporter: james
>         Attachments:
> I'm using an embedded broker with asynchronous startup enabled.  My setup worked using
5.9.0.  When i upgraded to 5.9.1, i started getting this exception on startup:
> {noformat}
> javax.jms.JMSException: java.lang.NullPointerException
>   at org.apache.activemq.util.JMSExceptionSupport.create(
>   at org.apache.activemq.ActiveMQConnection.syncSendPacket(
>   at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(
>   at org.apache.activemq.ActiveMQConnection.setClientID(
>   at <...internal system startup stack trace...>
> Caused by: java.lang.NullPointerException
>   at
>   at
>   at org.apache.activemq.advisory.AdvisoryBroker.addConnection(
>   at
>   at
>   at
>   at
>   at
>   at org.apache.activemq.command.ConnectionInfo.visit(
>   at
>   at$1.onCommand(
>   at org.apache.activemq.transport.ResponseCorrelator.onCommand(
>   at org.apache.activemq.transport.MutexTransport.onCommand(
>   at org.apache.activemq.transport.vm.VMTransport.iterate(
>   at org.apache.activemq.thread.PooledTaskRunner.runTask(
>   at org.apache.activemq.thread.PooledTaskRunner$
>   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
>   at java.util.concurrent.ThreadPoolExecutor$
>   at
> {noformat}

This message was sent by Atlassian JIRA

View raw message