You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vincent Lombart <ap...@lombart.be> on 2013/01/03 11:09:48 UTC

Re: Fork/join with resequencing

Hello,

Does anybody have an idea about what could sometimes cause a
NullPointerException in Camel code in the second route (all my messages are
built with the "seqnum" header)?

Vincent Lombart wrote
> 			from("seda:fork?concurrentConsumers=" + CONCURRENCY).process(
> 					myProcessor).to("seda:join");
> 			from("seda:join").resequence(header("seqnum")).stream()
> 					.capacity(CAPACITY).timeout(TIMEOUT).to("mock:result");

Here is the exception:
01:35:49.719 [Camel (camel-1) thread #0 - Resequencer Delivery] WARN 
o.a.c.processor.StreamResequencer - Caused by:
[java.lang.NullPointerException - null]
java.lang.NullPointerException: null
        at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:42)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:290)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:185)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:65)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:261)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:225)
~[camel-core-2.10.3.jar:2.10.3]
        at
org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:242)
~[camel-core-2.10.3.jar:2.10.3] 

Best regards
Vincent



--
View this message in context: http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724823.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Fork/join with resequencing

Posted by Vincent Lombart <ap...@lombart.be>.
Hello Taariq,

Thank you for taking the time to look into my problem. As suggested I have
opened the Jira  CAMEL-5925
<https://issues.apache.org/jira/browse/CAMEL-5925>   to let you attach a
patch.

Best regards
Vincent


Taariq Levack wrote
> For completion, that snippet wasn't complete but it you apply the change
> you'll see to also use that unitOfWork reference throughout the method,
> otherwise the null pointer will likely only be delayed.
> I'll run the camel-core tests tomorrow but your code worked consistently.
> 
> Taariq
> 
> On 03 Jan 2013, at 18:04, Taariq Levack &lt;

> taariql@

> &gt; wrote:
> 
>> Hi Vincent
>> 
>> I reproduced your error with your code in Camel 2.9 and 2.10, and maybe
>> you've found a bug. 
>> At first I thought it's your sleep calculations but even so we shouldn't
>> throw a null pointer.
>> 
>> Please file a JIRA so I can attach a patch and you can see if it works
>> for you too, but with the change I don't get this error. Or apply it and
>> try a build. 
>> I'm not sure if I'll have time soon to dig further into why this is, but
>> if so I'll take a few stabs at it, and maybe somebody else already knows
>> why and has a better solution.
>> 
>> The change is in RouteContextProcessor, line 42, replace it with this so
>> the unit of work isn't yanked out from underneath it, for some reason
>> it's set to null and I only see valid reasons so far, though with
>> concurrency it might not be valid at a certain time or context.
>> 
>> final UnitOfWork unitOfWork = exchange.getUnitOfWork();
>>         if (unitOfWork != null) {
>>             unitOfWork.pushRouteContext(routeContext);
>>         }
>> 
>> Taariq
>> 
>> 
>> 
>> On Thu, Jan 3, 2013 at 12:09 PM, Vincent Lombart &lt;

> apache@

> &gt; wrote:
>> Hello,
>> 
>> Does anybody have an idea about what could sometimes cause a
>> NullPointerException in Camel code in the second route (all my messages
>> are
>> built with the "seqnum" header)?
>> 
>> Vincent Lombart wrote
>> >                       from("seda:fork?concurrentConsumers=" +
>> CONCURRENCY).process(
>> >                                       myProcessor).to("seda:join");
>> >                      
>> from("seda:join").resequence(header("seqnum")).stream()
>> >                                      
>> .capacity(CAPACITY).timeout(TIMEOUT).to("mock:result");
>> 
>> Here is the exception:
>> 01:35:49.719 [Camel (camel-1) thread #0 - Resequencer Delivery] WARN
>> o.a.c.processor.StreamResequencer - Caused by:
>> [java.lang.NullPointerException - null]
>> java.lang.NullPointerException: null
>>         at
>> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:42)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:290)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:185)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:65)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:261)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:225)
>> ~[camel-core-2.10.3.jar:2.10.3]
>>         at
>> org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:242)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> 
>> Best regards
>> Vincent
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724823.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>





--
View this message in context: http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724856.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Fork/join with resequencing

Posted by Taariq Levack <ta...@gmail.com>.
For completion, that snippet wasn't complete but it you apply the change you'll see to also use that unitOfWork reference throughout the method, otherwise the null pointer will likely only be delayed.
I'll run the camel-core tests tomorrow but your code worked consistently.

Taariq

On 03 Jan 2013, at 18:04, Taariq Levack <ta...@gmail.com> wrote:

> Hi Vincent
> 
> I reproduced your error with your code in Camel 2.9 and 2.10, and maybe you've found a bug. 
> At first I thought it's your sleep calculations but even so we shouldn't throw a null pointer.
> 
> Please file a JIRA so I can attach a patch and you can see if it works for you too, but with the change I don't get this error. Or apply it and try a build. 
> I'm not sure if I'll have time soon to dig further into why this is, but if so I'll take a few stabs at it, and maybe somebody else already knows why and has a better solution.
> 
> The change is in RouteContextProcessor, line 42, replace it with this so the unit of work isn't yanked out from underneath it, for some reason it's set to null and I only see valid reasons so far, though with concurrency it might not be valid at a certain time or context.
> 
> final UnitOfWork unitOfWork = exchange.getUnitOfWork();
>         if (unitOfWork != null) {
>             unitOfWork.pushRouteContext(routeContext);
>         }
> 
> Taariq
> 
> 
> 
> On Thu, Jan 3, 2013 at 12:09 PM, Vincent Lombart <ap...@lombart.be> wrote:
> Hello,
> 
> Does anybody have an idea about what could sometimes cause a
> NullPointerException in Camel code in the second route (all my messages are
> built with the "seqnum" header)?
> 
> Vincent Lombart wrote
> >                       from("seda:fork?concurrentConsumers=" + CONCURRENCY).process(
> >                                       myProcessor).to("seda:join");
> >                       from("seda:join").resequence(header("seqnum")).stream()
> >                                       .capacity(CAPACITY).timeout(TIMEOUT).to("mock:result");
> 
> Here is the exception:
> 01:35:49.719 [Camel (camel-1) thread #0 - Resequencer Delivery] WARN
> o.a.c.processor.StreamResequencer - Caused by:
> [java.lang.NullPointerException - null]
> java.lang.NullPointerException: null
>         at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:42)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:290)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:185)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:65)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:261)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:225)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
> org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:242)
> ~[camel-core-2.10.3.jar:2.10.3]
> 
> Best regards
> Vincent
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724823.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 

Re: Fork/join with resequencing

Posted by Taariq Levack <ta...@gmail.com>.
Hi Vincent

I reproduced your error with your code in Camel 2.9 and 2.10, and maybe
you've found a bug.
At first I thought it's your sleep calculations but even so we shouldn't
throw a null pointer.

Please file a JIRA so I can attach a patch and you can see if it works for
you too, but with the change I don't get this error. Or apply it and try a
build.
I'm not sure if I'll have time soon to dig further into why this is, but if
so I'll take a few stabs at it, and maybe somebody else already knows why
and has a better solution.

The change is in RouteContextProcessor, line 42, replace it with this so
the unit of work isn't yanked out from underneath it, for some reason it's
set to null and I only see valid reasons so far, though with concurrency it
might not be valid at a certain time or context.

final UnitOfWork unitOfWork = exchange.getUnitOfWork();
        if (unitOfWork != null) {
            unitOfWork.pushRouteContext(routeContext);
        }

Taariq



On Thu, Jan 3, 2013 at 12:09 PM, Vincent Lombart <ap...@lombart.be> wrote:

> Hello,
>
> Does anybody have an idea about what could sometimes cause a
> NullPointerException in Camel code in the second route (all my messages are
> built with the "seqnum" header)?
>
> Vincent Lombart wrote
> >                       from("seda:fork?concurrentConsumers=" +
> CONCURRENCY).process(
> >                                       myProcessor).to("seda:join");
> >
> from("seda:join").resequence(header("seqnum")).stream()
> >
> .capacity(CAPACITY).timeout(TIMEOUT).to("mock:result");
>
> Here is the exception:
> 01:35:49.719 [Camel (camel-1) thread #0 - Resequencer Delivery] WARN
> o.a.c.processor.StreamResequencer - Caused by:
> [java.lang.NullPointerException - null]
> java.lang.NullPointerException: null
>         at
>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:42)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:290)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:185)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:65)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:261)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:225)
> ~[camel-core-2.10.3.jar:2.10.3]
>         at
>
> org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:242)
> ~[camel-core-2.10.3.jar:2.10.3]
>
> Best regards
> Vincent
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724823.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>