You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Yifan Wu (JIRA)" <ji...@apache.org> on 2018/02/13 20:20:00 UTC
[jira] [Updated] (CAMEL-12264) Concurrent modification in
safeCopyProperties Method of DefaultExchange
[ https://issues.apache.org/jira/browse/CAMEL-12264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yifan Wu updated CAMEL-12264:
-----------------------------
Description:
{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}
was:
{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}
{color:#ffc66d}{color:#333333}new LinkedList<>(Collection c) is not thread-safe. Quote from LinkedList implementation "{color}{color}
{color:#629755}The behavior of this operation is undefined if
{color}{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:
{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}
> 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
> 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)