[ 
https://issues.apache.org/jira/browse/CAMEL-12264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-12264.
---------------------------------
    Resolution: Cannot Reproduce

> Concurrent modification in safeCopyProperties Method of DefaultExchange
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-12264
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12264
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.20.2
>            Reporter: Yifan Wu
>            Priority: Minor
>
> {color:#ffc66d}{color:#333333}safeCopyProperties method  of DefaultExchange 
> class,{color} {color}
> {code:java}
> // new LinkedList<>(Collection c) is not thread-safe.
> answer.put(Exchange.MESSAGE_HISTORY, new LinkedList<>(history));
> {code}
>  new LinkedList<>(Collection c) is not thread-safe. Quote from LinkedList 
> implementation "The behavior of this operation is undefined if{color:#629755} 
> the specified collection is modified while the operation is 
> in{color}{color:#629755} progress."{color}
>  
>  {color:#333333}In our case, when we have high throughput, we see the 
> following exception (when the history is concurrently being modified.):{color}
> {color:#333333}java.lang.ArrayIndexOutOfBoundsException: 19
>          at java.util.LinkedList.toArray(LinkedList.java:1053)
>          at java.util.LinkedList.addAll(LinkedList.java:408)
>          at java.util.LinkedList.addAll(LinkedList.java:387)
>          at java.util.LinkedList.<init>(LinkedList.java:119)
>          at 
> org.apache.camel.impl.DefaultExchange.safeCopyProperties(DefaultExchange.java:152)
>          at 
> org.apache.camel.impl.DefaultExchange.copy(DefaultExchange.java:97)
>          at 
> org.apache.camel.util.ExchangeHelper.createCorrelatedCopy(ExchangeHelper.java:235)
>          at 
> org.apache.camel.util.ExchangeHelper.createCorrelatedCopy(ExchangeHelper.java:218)
>          at 
> org.apache.camel.processor.OnCompletionProcessor.prepareExchange(OnCompletionProcessor.java:190)
>          at 
> org.apache.camel.processor.OnCompletionProcessor$OnCompletionSynchronizationAfterConsumer.onComplete(OnCompletionProcessor.java:235)
>          at 
> org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:104)
>          at 
> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:229)
>          at 
> org.apache.camel.util.UnitOfWorkHelper.doneUow(UnitOfWorkHelper.java:65){color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to