[ https://issues.apache.org/jira/browse/CAMEL-4447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113159#comment-13113159 ]
Claus Ibsen commented on CAMEL-4447: ------------------------------------ Yeah you would need to adjust the patch accordingly. Or take a look at the backport to the 2.8 branch http://svn.apache.org/viewvc?view=revision&revision=1174248 > thread safety issue with Exchange.getUnitOfWork() > ------------------------------------------------- > > Key: CAMEL-4447 > URL: https://issues.apache.org/jira/browse/CAMEL-4447 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.8.1 > Environment: JDK 1.6.0_20 on Linux x86_64 > Reporter: David Tombs > Assignee: Claus Ibsen > Fix For: 2.8.2, 2.9.0 > > Attachments: CAMEL-4447.patch > > > I'm having a somewhat rare issue with NullPointerExceptions in a > multithreaded route. It seems that there is a race condition between one > thread operating on the UnitOfWork and another removing it. I have gotten the > following stacktraces so far: > {noformat} > ERROR [Camel0 - Resequencer Delivery] o.a.c.p.StreamResequencer - Caused by: > [java.lang.NullPointerException - null] > java.lang.NullPointerException: null > at > org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:309) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:349) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:305) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:116) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:79) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:59) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:165) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:61) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:254) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:218) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:212) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > {noformat} > And: > {noformat} > ERROR [Camel0 - Resequencer Delivery] o.a.c.p.StreamResequencer - Caused by: > [java.lang.NullPointerException - null] > java.lang.NullPointerException: null > at > org.apache.camel.impl.DefaultExchange.isTransacted(DefaultExchange.java:331) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:57) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:116) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:79) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:59) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:165) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:61) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:254) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:218) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > at > org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:212) > ~[camel-core-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT] > {noformat} > Looking at the source, both NullPointerExceptions were thrown by code like: > {code} > return getUnitOfWork() != null && getUnitOfWork().isTransacted(); > {code} > Oddly, I've only seen this happen soon after startup and only once per run. > The actual route is company confidential, but it's basically: > JMS -> Stream Resequencer -> Bean -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira