activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher L. Shannon (JIRA)" <>
Subject [jira] [Commented] (AMQ-5668) NPE in kahadb with concurrentStoreAndDispatchTopics when sending MQTT msgs with different QoS
Date Thu, 11 Jun 2015 01:09:01 GMT


Christopher L. Shannon commented on AMQ-5668:


Thanks for the bug report and for your test case.  I took a look at this and there is a race
condition.  As you pointed out, the best work around is probably to use concurrentStoreAndDispatchTopics="false"
for now.

In detail, the issue lies in the setLastCacheId method in AbstractStoreCursor which you can
see in the stack trace.  In the else clause in that method lastCachedIds[ index].getFutureOrSequenceLong()
is returning null because it hasn't been set yet.  KahaDB assigns that value when the message
is added to the store in a transaction.   However the TopicStorePefetch cursor is calling
trackLastCached before KahaDB actually gets around to finishing the transaction and assigning
the value, which happens asynchronously.

[~tabish121] and [~gtully], What do you guys thisnk about this?  It's certainly easy enough
to add a null check but then the value is never cached in setLastCachedId as it just skips
it.  This may not actually be a problem depending on what the lastCacheId is used for.  If
I add a null check in, the test case passes but it seems like there could be a larger concurrency
issue here that might need to be resolved besides just adding in a check for a null.

> NPE in kahadb with concurrentStoreAndDispatchTopics when sending MQTT msgs with different
> ---------------------------------------------------------------------------------------------
>                 Key: AMQ-5668
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, KahaDB, MQTT
>    Affects Versions: 5.11.1
>         Environment: MQTT, KahaDB
>            Reporter: Torsten Mielke
>              Labels: broker, kahadb, mqtt
>         Attachments: AMQ-5668Test.tgz
> Running KahaDB with concurrentStoreAndDispatchTopics="true" and sending 3 MQTT messages
using different QoS values raises 
> {code}
> 2015-03-17 13:27:48,866 WARN ActiveMQ NIO Worker 2 - Failed to send MQTT Publish:
> java.lang.NullPointerException
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at
> 	at org.apache.activemq.command.ActiveMQMessage.visit(
> 	at
> 	at$1.onCommand(
> 	at org.apache.activemq.transport.MutexTransport.onCommand(
> 	at org.apache.activemq.transport.mqtt.MQTTInactivityMonitor.onCommand(
> 	at org.apache.activemq.transport.mqtt.MQTTTransportFilter.sendToActiveMQ(
> 	at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.sendToActiveMQ(
> 	at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTPublish(
> 	at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTCommand(
> 	at org.apache.activemq.transport.mqtt.MQTTTransportFilter.onCommand(
> 	at org.apache.activemq.transport.TransportSupport.doConsume(
> 	at org.apache.activemq.transport.mqtt.MQTTCodec$1.onFrame(
> 	at org.apache.activemq.transport.mqtt.MQTTCodec.processCommand(
> 	at org.apache.activemq.transport.mqtt.MQTTCodec.access$400(
> 	at org.apache.activemq.transport.mqtt.MQTTCodec$4.parse(
> 	at org.apache.activemq.transport.mqtt.MQTTCodec$3.parse(
> 	at org.apache.activemq.transport.mqtt.MQTTCodec$2.parse(
> 	at org.apache.activemq.transport.mqtt.MQTTCodec.parse(
> 	at org.apache.activemq.transport.mqtt.MQTTNIOTransport.serviceRead(
> 	at org.apache.activemq.transport.mqtt.MQTTNIOTransport.access$000(
> 	at org.apache.activemq.transport.mqtt.MQTTNIOTransport$1.onSelect(
> 	at org.apache.activemq.transport.nio.SelectorSelection.onSelect(
> 	at org.apache.activemq.transport.nio.SelectorWorker$
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(
> 	at java.util.concurrent.ThreadPoolExecutor$
> 	at
> {code}

This message was sent by Atlassian JIRA

View raw message