Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentModificationException when launching a wave #202

Closed
Rizen59 opened this issue Aug 24, 2016 · 3 comments
Closed

ConcurrentModificationException when launching a wave #202

Rizen59 opened this issue Aug 24, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@Rizen59
Copy link
Contributor

Rizen59 commented Aug 24, 2016

Hi Seb', hope everything goes fine for you.
Here is an exception I recently get in 8.0.5.

java.util.ConcurrentModificationException: null
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) ~[na:1.8.0_66]
    at java.util.ArrayList$Itr.next(ArrayList.java:851) ~[na:1.8.0_66]
    at org.jrebirth.af.core.concurrent.JRebirthThreadPoolExecutor.checkPriority(JRebirthThreadPoolExecutor.java:87) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.concurrent.JRebirthThreadPoolExecutor.checkAvailability(JRebirthThreadPoolExecutor.java:75) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.concurrent.JRebirthThread.runIntoJTP(JRebirthThread.java:103) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.concurrent.JRebirth.runIntoJTP(JRebirth.java:168) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.service.AbstractService.runTask(AbstractService.java:173) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.service.AbstractService.returnData(AbstractService.java:122) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.link.NotifierBase.returnData(NotifierBase.java:171) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.link.NotifierBase.sendWave(NotifierBase.java:105) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.component.basic.AbstractComponent$3.runInto(AbstractComponent.java:284) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.concurrent.AbstractJrbRunnable.run(AbstractJrbRunnable.java:80) ~[core-8.0.5.jar:na]
    at org.jrebirth.af.core.concurrent.JRebirthThread.run(JRebirthThread.java:170) ~[core-8.0.5.jar:na]

Correction seems easy, probably use a CopyOnWriteArrayList instead of ArrayList.
Most difficult here is to right the unit test for this error and I will probably not have time to write it today, so I create the issue first.

@Rizen59 Rizen59 changed the title ConcurrentModificationException ConcurrentModificationException when launching a wave Aug 24, 2016
@sbordes sbordes self-assigned this Aug 24, 2016
@sbordes sbordes added this to the 8.5.0 milestone Aug 24, 2016
@sbordes sbordes added the bug label Aug 24, 2016
@sbordes
Copy link
Member

sbordes commented Aug 24, 2016

An execution (after or before) has probably be done when checking availability of the executor.
The CopyOnWriteArrayList class wll copy the list so i prefer to fix it by synchronizing the list access, it will lock all execution when performing the iteration fo the checkAvailability (really fast only getting the priority) instead of recreating a new list each time.

@sbordes
Copy link
Member

sbordes commented Aug 24, 2016

I will try to switch on again the ci server to perform a 8.5.0 build tonight

@Rizen59
Copy link
Contributor Author

Rizen59 commented Aug 25, 2016

Nice and quick fix ! Well done !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants