[ 
https://issues.apache.org/jira/browse/QPID-7777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16006368#comment-16006368
 ] 

Keith Wall edited comment on QPID-7777 at 5/11/17 1:01 PM:
-----------------------------------------------------------

This problem can only occur on master. 6.1.x is not affected.

We have a race between flowToDisk and a consumer target.

# Flow to disk calls {{MessageMetaData_1_0#clearEncodedForm}}, which internally 
calls {{MessageMetaData_1_0#dispose}}!  This calls dispose on all the sections.
# Meanwhile, a consumer executes {{ConsumerTarget_1_0#doSend}} which gets the 
{{HeaderSection}} from the MMD.  The HeaderSection it gets belongs to the 
{{MessageMetaData_1_0 }} (same object).  The ConsumerTarget then NPEs when it 
calls payload.addAll(headerSection.getEncodedForm()).

I see three problems:

# {{MessageMetaData_1_0#clearEncodedForm}} should be asking the Sections to 
clearEncodedForm, not dispose (we are not done with them yet).
# {{Sections}} needs to be prepared to recreate the encoded form (like their 
AMQP 0-9 counterparts). 
# {{MessageMetaData_1_0.getHeader}} should not expose its own {{HeaderSection}} 
but a copy instead.  The caller needs to #dispose of it once he’s done.



was (Author: k-wall):
This problem can only occur on master. 6.1.x is not affected.

We have a race between flowToDisk and a consumer target.

# Flow to disk calls MessageMetaData_1_0#clearEncodedForm, which internally 
calls MessageMetaData_1_0#dispose!  This calls dispose on all the sections.
# Meanwhile, a consumer executes ConsumerTarget_1_0#doSend which gets the 
HeaderSection from the MMD.  The HeaderSection it gets belongs to the 
MessageMetaData_1_0  (same object).  The ConsumerTarget then NPEs when it calls 
payload.addAll(headerSection.getEncodedForm()).

I see three problems:

# MessageMetaData_1_0#clearEncodedForm should be asking the Sections to 
clearEncodedForm, not dispose (we are not done with them yet).
# Sections needs to be prepared to recreate the encoded form (like their AMQP 
0-9 counterparts). 
# MessageMetaData_1_0.getHeader should not expose its own HeaderSection but a 
copy.  The caller needs to dispose of it once he’s done.


> [AMQP 1.0] NPE during consumer target delivery path 
> ----------------------------------------------------
>
>                 Key: QPID-7777
>                 URL: https://issues.apache.org/jira/browse/QPID-7777
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: qpid-java-broker-7.0.0
>            Reporter: Keith Wall
>             Fix For: qpid-java-broker-7.0.0
>
>
> The following NPE was encountered during a performance test run.   The logs 
> showed that the Broker was flowing messages to disk at the time.
> {noformat}
> java.lang.NullPointerException: null
>         at 
> org.apache.qpid.server.protocol.v1_0.type.messaging.AbstractSection.getEncodedForm(AbstractSection.java:78)
>         at 
> org.apache.qpid.server.protocol.v1_0.ConsumerTarget_1_0.doSend(ConsumerTarget_1_0.java:157)
>         at 
> org.apache.qpid.server.consumer.AbstractConsumerTarget.send(AbstractConsumerTarget.java:206)
>         at 
> org.apache.qpid.server.consumer.AbstractConsumerTarget.sendNextMessage(AbstractConsumerTarget.java:247)
>         at 
> org.apache.qpid.server.consumer.AbstractConsumerTarget.processPending(AbstractConsumerTarget.java:142)
>         at 
> org.apache.qpid.server.session.AbstractAMQPSession.processPending(AbstractAMQPSession.java:391)
>         at 
> org.apache.qpid.server.protocol.v1_0.AMQPConnection_1_0Impl$ProcessPendingIterator$3.run(AMQPConnection_1_0Impl.java:1755)
>         at 
> org.apache.qpid.server.transport.NonBlockingConnection.processPending(NonBlockingConnection.java:356)
>         at 
> org.apache.qpid.server.transport.NonBlockingConnection.doWork(NonBlockingConnection.java:264)
>         at 
> org.apache.qpid.server.transport.NetworkConnectionScheduler.processConnection(NetworkConnectionScheduler.java:124)
>         at 
> org.apache.qpid.server.transport.SelectorThread$ConnectionProcessor.processConnection(SelectorThread.java:563)
>         at 
> org.apache.qpid.server.transport.SelectorThread$ConnectionProcessor.run(SelectorThread.java:551)
>         at 
> org.apache.qpid.server.transport.SelectorThread.run(SelectorThread.java:521)
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:745)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to