ConcurrentModificationException when launching a wave #202

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

Comments

Projects
None yet
2 participants
@Rizen59
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 from ConcurrentModificationException to 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

This comment has been minimized.

Show comment
Hide comment
@sbordes

sbordes Aug 24, 2016

Member

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.

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 sbordes closed this in a8183e8 Aug 24, 2016

@sbordes

This comment has been minimized.

Show comment
Hide comment
@sbordes

sbordes Aug 24, 2016

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@Rizen59

Rizen59 Aug 25, 2016

Contributor

Nice and quick fix ! Well done !

Contributor

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