You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by m....@icw.de on 2011/07/25 10:59:08 UTC
EmptyStackException in DefaultUnitOfWork.popRouteContext()
Hi *,
we're seeing the exception below happening randomly under load. It stems
from
org/apache/camel/impl/DefaultUnitOfWork.java:
public RouteContext popRouteContext() {
if (routeContextStack.isEmpty()) {
return null;
}
return routeContextStack.pop();
}
It seems the stack gets empty inbetween the empty-check and the pop
operation.
What about doing something like this, to prevent this inconsistency:
public RouteContext popRouteContext() {
synchronized (routeContextStack) {
if (routeContextStack.isEmpty()) {
return null;
}
return routeContextStack.pop();
}
}
should i file a JIRA issue for this?
cheers,
Matthias
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:85)
at java.util.Stack.pop(Stack.java:67)
at
org.apache.camel.impl.DefaultUnitOfWork.popRouteContext(DefaultUnitOfWork.java:226)
at
org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:260)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:143)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:78)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:113)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
at
org.apache.camel.processor.aggregate.AggregateProcessor$1.run(AggregateProcessor.java:397)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Matthias Schmidt | Senior Software Engineer | Development & Delivery
InterComponentWare AG | Altrottstraße 31 | 69190 Walldorf (Baden) |
Germany
Tel.: +49 (0) 6227 385 333 81 | Fax: +49 (0) 6227 385 471
m.schmidt@icw.de | www.icw.de
InterComponentWare AG:
Vorstand: Peter Kirschbauer (Vors.), Jörg Stadler
Aufsichtsratsvors.: Prof. Dr. Christof Hettich
Firmensitz: 69190 Walldorf, Altrottstraße 31
AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516
Re: EmptyStackException in DefaultUnitOfWork.popRouteContext()
Posted by m....@icw.de.
Hi Willem,
and thx for this super-fast response! I'm looking at your fix here:
https://fisheye6.atlassian.com/changelog/camel?cs=1150651
and wonder, whether it's really necessary to sync on routeContext in the
pushRouteContext() method?
cheers,
Matthias
Matthias Schmidt | Senior Software Engineer | Development & Delivery
InterComponentWare AG | Altrottstraße 31 | 69190 Walldorf (Baden) |
Germany
Tel.: +49 (0) 6227 385 333 81 | Fax: +49 (0) 6227 385 471
m.schmidt@icw.de | www.icw.de
From:
Willem Jiang <wi...@gmail.com>
To:
users@camel.apache.org
Date:
25.07.2011 12:04
Subject:
Re: EmptyStackException in DefaultUnitOfWork.popRouteContext()
Hi,
It looks like an bug of DefaultUnitOfWork, I just create a JIRA[1] for
it and will commit a quick fix for it.
Thanks for reporting this.
[1]https://issues.apache.org/jira/browse/CAMEL-4264
On 7/25/11 4:59 PM, m.schmidt@icw.de wrote:
> Hi *,
>
> we're seeing the exception below happening randomly under load. It stems
> from
>
> org/apache/camel/impl/DefaultUnitOfWork.java:
>
> public RouteContext popRouteContext() {
> if (routeContextStack.isEmpty()) {
> return null;
> }
> return routeContextStack.pop();
> }
>
> It seems the stack gets empty inbetween the empty-check and the pop
> operation.
>
> What about doing something like this, to prevent this inconsistency:
>
> public RouteContext popRouteContext() {
> synchronized (routeContextStack) {
> if (routeContextStack.isEmpty()) {
> return null;
> }
> return routeContextStack.pop();
> }
> }
>
> should i file a JIRA issue for this?
>
> cheers,
>
> Matthias
>
>
> java.util.EmptyStackException
> at java.util.Stack.peek(Stack.java:85)
> at java.util.Stack.pop(Stack.java:67)
> at
>
org.apache.camel.impl.DefaultUnitOfWork.popRouteContext(DefaultUnitOfWork.java:226)
> at
>
org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:260)
> at
>
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)
> at
>
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
> at
>
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)
> at
>
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
> at
org.apache.camel.processor.Pipeline.process(Pipeline.java:143)
> at
org.apache.camel.processor.Pipeline.process(Pipeline.java:78)
> at
>
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:113)
> at
>
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
> at
>
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
> at
>
org.apache.camel.processor.aggregate.AggregateProcessor$1.run(AggregateProcessor.java:397)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
>
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
>
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
>
>
>
>
>
> Matthias Schmidt | Senior Software Engineer | Development& Delivery
> InterComponentWare AG | Altrottstraße 31 | 69190 Walldorf (Baden) |
> Germany
> Tel.: +49 (0) 6227 385 333 81 | Fax: +49 (0) 6227 385 471
> m.schmidt@icw.de | www.icw.de
>
>
>
>
>
>
>
>
> InterComponentWare AG:
> Vorstand: Peter Kirschbauer (Vors.), Jörg Stadler
> Aufsichtsratsvors.: Prof. Dr. Christof Hettich
> Firmensitz: 69190 Walldorf, Altrottstraße 31
> AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
InterComponentWare AG:
Vorstand: Peter Kirschbauer (Vors.), Jörg Stadler
Aufsichtsratsvors.: Prof. Dr. Christof Hettich
Firmensitz: 69190 Walldorf, Altrottstraße 31
AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516
Re: EmptyStackException in DefaultUnitOfWork.popRouteContext()
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
It looks like an bug of DefaultUnitOfWork, I just create a JIRA[1] for
it and will commit a quick fix for it.
Thanks for reporting this.
[1]https://issues.apache.org/jira/browse/CAMEL-4264
On 7/25/11 4:59 PM, m.schmidt@icw.de wrote:
> Hi *,
>
> we're seeing the exception below happening randomly under load. It stems
> from
>
> org/apache/camel/impl/DefaultUnitOfWork.java:
>
> public RouteContext popRouteContext() {
> if (routeContextStack.isEmpty()) {
> return null;
> }
> return routeContextStack.pop();
> }
>
> It seems the stack gets empty inbetween the empty-check and the pop
> operation.
>
> What about doing something like this, to prevent this inconsistency:
>
> public RouteContext popRouteContext() {
> synchronized (routeContextStack) {
> if (routeContextStack.isEmpty()) {
> return null;
> }
> return routeContextStack.pop();
> }
> }
>
> should i file a JIRA issue for this?
>
> cheers,
>
> Matthias
>
>
> java.util.EmptyStackException
> at java.util.Stack.peek(Stack.java:85)
> at java.util.Stack.pop(Stack.java:67)
> at
> org.apache.camel.impl.DefaultUnitOfWork.popRouteContext(DefaultUnitOfWork.java:226)
> at
> org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:260)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
> at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:143)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:78)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:113)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
> at
> org.apache.camel.processor.aggregate.AggregateProcessor$1.run(AggregateProcessor.java:397)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
>
>
>
>
>
> Matthias Schmidt | Senior Software Engineer | Development& Delivery
> InterComponentWare AG | Altrottstraße 31 | 69190 Walldorf (Baden) |
> Germany
> Tel.: +49 (0) 6227 385 333 81 | Fax: +49 (0) 6227 385 471
> m.schmidt@icw.de | www.icw.de
>
>
>
>
>
>
>
>
> InterComponentWare AG:
> Vorstand: Peter Kirschbauer (Vors.), Jörg Stadler
> Aufsichtsratsvors.: Prof. Dr. Christof Hettich
> Firmensitz: 69190 Walldorf, Altrottstraße 31
> AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang