Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-754

FC: ConcurrentModificationException in handleViewChange()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.6.3, 2.7
    • 2.6.2
    • None

      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)

              rhn-engineering-bban Bela Ban
              philippejulien_jira Philippe Julien (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: