camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chad Wilson <c.wil...@baml.com>
Subject Bean component / BeanInfo thread safety
Date Wed, 16 Feb 2011 05:58:24 GMT

Hi guys

An issue occurred today which surprised me - Camel 2.4.0 threw a
ConcurrentModificationException and caused a message to be lost on a route.

We have a route that essentially simplifies down to


from("jms:queue:myQueue?concurrentConsumers=3")
    .unmarshal()
    .to("bean:mySpringBean");


mySpringBean is a immutable singleton bean managed/instantiated from Spring
that we use for some custom processing, and generating a reply that goes
done a different route.

Immediately after service startup, three messages were dumped onto the JMS
queue, leading to the following exception in one of the three JMS threads:


java.util.ConcurrentModificationException
        at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
        at java.util.AbstractList$Itr.remove(Unknown Source)
        at
org.apache.camel.component.bean.BeanInfo.removeAllSetterOrGetterMethods(BeanInfo.java:650)
        at
org.apache.camel.component.bean.BeanInfo.chooseMethod(BeanInfo.java:370)
        at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:157)
        at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:142)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
        at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
        at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202)
        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:99)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
        at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:85)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
        at <snip>


Looking at the BeanInfo code, I can see that it's obviously not threadsafe
in the way that it deals with the List<MethodInfo>s - so are we making
assumptions that we shouldn't when using this component? Code seems roughly
similar in Camel 2.6.0 so don't think this is version specific.

Cheers
Chad
-- 
View this message in context: http://camel.465427.n5.nabble.com/Bean-component-BeanInfo-thread-safety-tp3387197p3387197.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message