-
Bug
-
Resolution: Done
-
Major
-
3.6.2
-
None
I have code which unregisters a lock listener whilst a lock notification event is being fired leading to
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:926)
at java.util.HashMap$KeyIterator.next(HashMap.java:960)
at org.jgroups.protocols.Locking.notifyUnlocked(Locking.java:581)
at org.jgroups.protocols.Locking$ServerLock.setOwner(Locking.java:767)
at org.jgroups.protocols.Locking$ServerLock.handleRequest(Locking.java:655)
at org.jgroups.protocols.Locking.handleLockRequest(Locking.java:393)
at org.jgroups.protocols.Locking.up(Locking.java:226)
at org.jgroups.stack.Protocol.up(Protocol.java:412)
at org.jgroups.protocols.FORK.up(FORK.java:139)
at org.jgroups.protocols.FRAG2.up(FRAG2.java:182)
at org.jgroups.protocols.FlowControl.up(FlowControl.java:447)
at org.jgroups.protocols.FlowControl.up(FlowControl.java:447)
at org.jgroups.stack.Protocol.up(Protocol.java:420)
at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:294)
at org.jgroups.protocols.UNICAST3.deliverBatch(UNICAST3.java:1087)
at org.jgroups.protocols.UNICAST3.removeAndDeliver(UNICAST3.java:886)
at org.jgroups.protocols.UNICAST3.handleDataReceivedFromSelf(UNICAST3.java:821)
at org.jgroups.protocols.UNICAST3.up(UNICAST3.java:424)
at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java:652)
at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:155)
at org.jgroups.protocols.FD.up(FD.java:253)
at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:297)
at org.jgroups.protocols.MERGE3.up(MERGE3.java:288)
at org.jgroups.protocols.Discovery.up(Discovery.java:291)
at org.jgroups.protocols.TP$ProtocolAdapter.up(TP.java:2842)
at org.jgroups.protocols.TP.passMessageUp(TP.java:1577)
at org.jgroups.protocols.TP$3.run(TP.java:1511)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
The org.jgroups.protocols.Locking#lock_listeners is simple a HashSet which gets iterated over, This needs to be synchronised is some way.