[jboss-jira] [JBoss JIRA] Created: (JGRP-754) FC: ConcurrentModificationException in handleViewChange()

Philippe Julien (JIRA) jira-events at lists.jboss.org
Fri May 9 15:27:22 EDT 2008


FC: ConcurrentModificationException in handleViewChange()
---------------------------------------------------------

                 Key: JGRP-754
                 URL: http://jira.jboss.com/jira/browse/JGRP-754
             Project: JGroups
          Issue Type: Bug
    Affects Versions: 2.6.2
            Reporter: Philippe Julien
         Assigned To: Bela Ban


FC can throw a ConcurrentModificationException on a view change.

The following code is not correct:

for(Address creditor: creditors) {
    if(!mbrs.contains(creditor))
        creditors.remove(creditor);
}

To fix it replace it with something like that:
for(Iterator<Address> it=creditors.iterator(); it.hasNext();) {
    Address creditor = (Address)it.next();
    if(!mbrs.contains(creditor))
        it.remove();
}

Here is the exception:
java.util.ConcurrentModificationException
      at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
      at java.util.HashMap$KeyIterator.next(HashMap.java:877)
      at org.jgroups.protocols.FC.handleViewChange(FC.java:791)
      at org.jgroups.protocols.FC.up(FC.java:422)
      at org.jgroups.protocols.pbcast.GMS.installView(GMS.java:500)
      at org.jgroups.protocols.pbcast.CoordGmsImpl.handleViewChange(CoordGmsImpl.java:430)
      at org.jgroups.protocols.pbcast.GMS.up(GMS.java:663)
      at org.jgroups.protocols.VIEW_SYNC.up(VIEW_SYNC.java:193)
      at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:234)
      at org.jgroups.protocols.UNICAST.up(UNICAST.java:293)
      at org.jgroups.protocols.pbcast.NAKACK.handleMessage(NAKACK.java:858)
      at org.jgroups.protocols.pbcast.NAKACK.up(NAKACK.java:687)
      at org.jgroups.protocols.BARRIER.up(BARRIER.java:136)
      at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:167)
      at org.jgroups.protocols.FD.up(FD.java:285)
      at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:308)
      at org.jgroups.protocols.MERGE2.up(MERGE2.java:145)
      at org.jgroups.protocols.Discovery.up(Discovery.java:245)
      at org.jgroups.protocols.TP.passMessageUp(TP.java:1132)
      at org.jgroups.protocols.TP.access$100(TP.java:48)
      at org.jgroups.protocols.TP$1.run(TP.java:1035)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list