History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CAMEL-715
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Willem Jiang
Reporter: Wojciech Durczynski
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Apache Camel

ConcurrentModificationException in ThreadProcessor

Created: 14/Jul/08 03:19 AM   Updated: 23/Jul/08 10:17 PM
Component/s: camel-core
Affects Version/s: 1.4.0
Fix Version/s: 1.5.0

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File Licensed for inclusion in ASF works JUnitTestCase.java 2008-07-14 07:15 AM Wojciech Durczynski 2 kb


 Description  « Hide
When defining very simple routing with ThreadProcessor I get ConcurrentModificationException on multicore systems.

Example:
from("direct:a").thread(10).process(new Processor() {

@Override
public void process(Exchange ex) throws Exception { //sth }
});

Stack trace:
Exception in thread "Thread Processor"
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
at java.util.HashMap$EntryIterator.next(HashMap.java:834)
at java.util.HashMap$EntryIterator.next(HashMap.java:832)
at java.util.HashMap.putAll(HashMap.java:523)
at
org.apache.camel.processor.Pipeline.createNextExchange(Pipeline.java:146
)
at org.apache.camel.processor.Pipeline$1.done(Pipeline.java:123)
at
org.apache.camel.processor.ThreadProcessor$ProcessCall.run(ThreadProcess
or.j
ava:66)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.ja
va:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:9
07)
at java.lang.Thread.run(Thread.java:619)



 All   Comments   Work Log   Change History   Subversion Commits   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Claus Ibsen - 14/Jul/08 06:17 AM
Hi

Could you attach your sample that doesn't work on your system.

I have tried to create an unit test that demonstrates the bug but I runs fine here.


Claus Ibsen - 14/Jul/08 06:18 AM
And please provide us with information about OS: Camel Version, Java Version etc.

Wojciech Durczynski - 14/Jul/08 07:05 AM
JUnit test case that causes error

Wojciech Durczynski - 14/Jul/08 07:09 AM
Attached test case causes ConcurrentModificationException.
It happens on multicore machines only (always on quad core processor, never on single core)

Testing environment:
jdk 1.6.0_06
camel 1.4-SNAPSHOT
windows xp
eclipse 3.4


Wojciech Durczynski - 14/Jul/08 07:15 AM
Attachment without license

Claus Ibsen - 14/Jul/08 07:28 AM
Wojciech. Thanks for the test. It fails on my laptop as well.

However I must say though that such a scenario isn't really a real use-case. Who will fire 500000 messages simulationsly in one thread
But we will try to look into it.