[ 
https://issues.apache.org/activemq/browse/CAMEL-2958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60792#action_60792
 ] 

Christian Mouttet commented on CAMEL-2958:
------------------------------------------

Got it!
I found the bug.

Has something to do with splitter & aggregator. In my route I receive from 
servlet do some splitting with xpath performing business methods from a bean 
and holding the aggregated responses (e.g. a List) in a claim check. Key is the 
original message-id before splitting. Outside the split the claim check is read 
again and is set as response for the servlet. (Without that tricky stuff I only 
got the last split element.)

I don't understand what modifies the map.entrySet (CaseInsensitiveMap:90 
[trunk]) out of the aggregation thread. Anyway with your synchronizes it works 
well.

BTW. I read that volatile can fix the broken double check idiom: 
http://jeremymanson.blogspot.com/2008/05/double-checked-locking.html

> java.util.ConcurrentModificationException in Method 
> org.apache.camel.util.CaseInsensitiveMap.putAll()
> -----------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2958
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2958
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.3.0
>         Environment: Ubuntu Linux 10.04 i386
> Sun JDK 1.6.0_20-b02
> Glassfish 2.1
>            Reporter: Christian Mouttet
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>         Attachments: CaseInsensitiveMap.java
>
>
> Every now and then I'm facing the ConcurrentModificationException. It very 
> hard to reproduce. This is my stack trace:
> Failed delivery for exchangeId: ba969718-9044-4261-bc57-ca10aafb0a03. 
> Exhausted after delivery attempt: 1 caught: 
> java.util.ConcurrentModificationException
> java.util.ConcurrentModificationException: null
>         at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) 
> [na:1.6.0_20]
>         at java.util.HashMap$KeyIterator.next(HashMap.java:828) [na:1.6.0_20]
>         at 
> org.apache.camel.util.CaseInsensitiveMap.putAll(CaseInsensitiveMap.java:86) 
> [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.impl.MessageSupport.copyFrom(MessageSupport.java:142) 
> [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.impl.DefaultMessage.copyFrom(DefaultMessage.java:52) 
> [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.util.ExchangeHelper.copyResults(ExchangeHelper.java:199) 
> [camel-core-2.3.0.jar:2.3.0]
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:114) 
> [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:51) 
> [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:97)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:185)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:151)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:89)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228) 
> [camel-core-2.3.0.jar:2.3.0]
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:75) 
> [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:70)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>  [camel-core-2.3.0.jar:2.3.0]
>         at 
> org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:71) 
> [camel-http-2.3.0.jar:2.3.0]
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) 
> [javaee.jar:9.1]
> ...
> Looks like CaseInsensitiveMap isn't enough thread save. But I have no idea 
> what other thread is modifies the map. Most of the time everything is ok.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to