[
https://issues.apache.org/jira/browse/QPID-2565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12993381#comment-12993381
]
Keith Wall commented on QPID-2565:
----------------------------------
Attaching stack trace from original report:
2010-04-30 00:51:32,071 ERROR [pool-1-thread-7]
protocol.AMQPFastProtocolHandler (AMQPFastProtocolHandler.java:217) - Exception
caught in/xxx.xxx.xxx.xxxx:pppppp(nnnnnnnn), closing session explictly:
java.lang.NullPointerException
java.lang.NullPointerException
at
org.apache.qpid.server.exchange.TopicExchange$TopicExchangeResult.processMessage(TopicExchange.java:291)
at
org.apache.qpid.server.exchange.TopicExchange.getMatchedQueues(TopicExchange.java:663)
at org.apache.qpid.server.exchange.TopicExchange.route(TopicExchange.java:539)
at org.apache.qpid.server.queue.IncomingMessage.route(IncomingMessage.java:312)
at org.apache.qpid.server.AMQChannel.routeCurrentMessage(AMQChannel.java:253)
at org.apache.qpid.server.AMQChannel.publishContentHeader(AMQChannel.java:179)
at
org.apache.qpid.server.protocol.AMQMinaProtocolSession.contentHeaderReceived(AMQMinaProtocolSession.java:368)
at org.apache.qpid.framing.ContentHeaderBody.handle(ContentHeaderBody.java:118)
at
org.apache.qpid.server.protocol.AMQMinaProtocolSession.frameReceived(AMQMinaProtocolSession.java:240)
at
org.apache.qpid.server.protocol.AMQMinaProtocolSession.dataBlockReceived(AMQMinaProtocolSession.java:197)
at
org.apache.qpid.server.protocol.AMQPFastProtocolHandler.messageReceived(AMQPFastProtocolHandler.java:244)
at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:703)
at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
at org.apache.qpid.pool.PoolingFilter.messageReceived(PoolingFilter.java:334)
at
org.apache.mina.filter.ReferenceCountingIoFilter.messageReceived(ReferenceCountingIoFilter.java:96)
at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
at
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:60)
at
org.apache.mina.filter.codec.QpidProtocolCodecFilter.messageReceived(QpidProtocolCodecFilter.java:174)
at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
at org.apache.qpid.pool.Event$ReceivedEvent.process(Event.java:86)
at org.apache.qpid.pool.Job.processAll(Job.java:114)
at org.apache.qpid.pool.Job.run(Job.java:153)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
2010-04-30 00:51:32,102 ERROR [pool-1-thread-7]
protocol.AMQPFastProtocolHandler (AMQPFastProtocolHandler.java:217) - Exception
caught in/xxx.xxx.xxx.xxx:ppppp(xxxxxx), closing session explictly:
java.lang.NullPointerException
java.lang.NullPointerException
at
org.apache.qpid.server.queue.IncomingMessage.addContentBodyFrame(IncomingMessage.java:247)
at org.apache.qpid.server.AMQChannel.publishContentBody(AMQChannel.java:234)
at
org.apache.qpid.server.protocol.AMQMinaProtocolSession.contentBodyReceived(AMQMinaProtocolSession.java:376)
at org.apache.qpid.framing.ContentBody.handle(ContentBody.java:83)
at
org.apache.qpid.server.protocol.AMQMinaProtocolSession.frameReceived(AMQMinaProtocolSession.java:240)
at
org.apache.qpid.server.protocol.AMQMinaProtocolSession.dataBlockReceived(AMQMinaProtocolSession.java:197)
at
org.apache.qpid.server.protocol.AMQPFastProtocolHandler.messageReceived(AMQPFastProtocolHandler.java:244)
at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:703)
at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
at org.apache.qpid.pool.PoolingFilter.messageReceived(PoolingFilter.java:334)
at
org.apache.mina.filter.ReferenceCountingIoFilter.messageReceived(ReferenceCountingIoFilter.java:96)
at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
at
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:60)
at
org.apache.mina.filter.codec.QpidProtocolCodecFilter.messageReceived(QpidProtocolCodecFilter.java:174)
at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
at
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
at org.apache.qpid.pool.Event$ReceivedEvent.process(Event.java:86)
at org.apache.qpid.pool.Job.processAll(Job.java:114)
at org.apache.qpid.pool.Job.run(Job.java:153)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
2010-04-30 07:57:41,482 ERROR [SocketAcceptorIoProcessor-0.1]
protocol.AMQPFastProtocolHandler (AMQPFastProtocolHandler.java:213) -
IOException caught in/xxx.xxx.xxx.xxx:ppppp(nnnnn), session closed implictly:
java.io.IOException: Connection reset by peer
> Topic exchange may NPE during message routing
> ---------------------------------------------
>
> Key: QPID-2565
> URL: https://issues.apache.org/jira/browse/QPID-2565
> Project: Qpid
> Issue Type: Bug
> Affects Versions: M4, 0.5, 0.6, 0.7
> Reporter: Robbie Gemmell
>
> Summary:
> The Topic exchange may generate an NPE during the message routing process, as
> seen in IBAMQ-1344. It is believed this can only be attributed to 'undefined
> behaviour' defined in the map.Entry Javadoc, which may be exhibited by
> Map.Entry objects returned from an Iterator over the keySet() and entrySet()
> results of a ConcurrentHashMap in the event the map is updated directly
> following generation of the Map.Entry. The code section in question should be
> updated to remove use of Map.Entry since its behaviour in this case cannot be
> guaranteed otherwise without additional locking that would hinder performance
> of the exchange.
> Additional Detail:
> It hasnt been possible to reproduce the error thus far, and at first glance
> it was believed the code in question should never be able to NPE, as none of
> the methods should be able to return null based on the fact they either
> return a new Set() or a key/value that can never be null, as null can never
> be entered into the map.
> However, searching the Sun JDK BugDatabase revealed a historical instance (
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6312056 ) where the
> Map.Entry.value() did return null, and although this case was fixed the
> report also draws attention to the fact that usage of Map.Entry's returned by
> the Iterator from a ConcurrentHashMap are not completely safe, and may
> exhibit 'undefined behaviour' if the Map is modified thereafter via any means
> other than the map.Entry itself, despite the fact the Iterator itself is safe
> in such cases.
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.Entry.html states:
> "These Map.Entry objects are valid only for the duration of the iteration;
> more formally, the behavior of a map entry is undefined if the backing map
> has been modified after the entry was returned by the iterator, except
> through the setValue operation on the map entry. "
> The NPE occurs on the last line of the following code section:
> for(Map.Entry<AMQQueue, Map<MessageFilter<RuntimeException>, Integer>> entry
> : _filteredQueues.entrySet())
> {
> if(!queues.contains(entry.getKey()))
> {
> for(MessageFilter<RuntimeException> filter :
> entry.getValue().keySet())
> The _filteredQueues map is a ConcurrentHashMap, itself containing
> ConcurrentHashMap values. It is not possible for a null to be used as either
> key or value in a CHM, and both keyset() or entrySet() return a new Set if
> none previously existed. As a result it would seem that it should not be
> possible for the above line to ever contain a null unless due to the
> aforementioned undefined behaviour.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]