You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ConcurrentModificationException when looping connections #921
Describe the bug
ConcurrentModificationException when looping connections returned by getConnections() and a connection is created/removed elsewhere at the same time.
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:810)
at java.util.HashMap$KeyIterator.next(HashMap.java:845)
at java.util.AbstractCollection.toArray(AbstractCollection.java:141)
at java.util.ArrayList.<init>(ArrayList.java:151)
at org.java_websocket.server.WebSocketServer.getConnections(WebSocketServer.java:289)
...
To Reproduce
Steps to reproduce the behavior:
. Create a thread that requests connections via getConnections() and iterates over the connections (say gathering stats). Run all of that in a loop.
.. Whilst that thread is running connect and disconnect from the WebSocket server using a WebSocket client.
... Should see an intermittent race condition leading to a ConcurrentModificationException
Expected behavior
No ConcurrentModificationException
Environment(please complete the following information):
Activity
marci4 commentedon Aug 12, 2019
Fixed with #922