You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2018/03/22 11:55:00 UTC

[jira] [Commented] (CAMEL-12264) Concurrent modification in safeCopyProperties Method of DefaultExchange

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

Claus Ibsen commented on CAMEL-12264:
-------------------------------------

Can you tell more about your application and what you do, eg where do you use that onCompletion and what Camel components are used on the consumer etc. And how high is your high load

> 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)