Skip to content

Report: ConcurrentModificationException when use AckWithTimout... #759

Description

@duan-nguyen

Describe the bug
Report: ConcurrentModificationException when use AckWithTimout...
(no issues with regular Ack(), only with AckWithTimout because of concurrent / thread-safe ...)

To Reproduce

Please fill the following code example:

Client

multi-thread...
        socket.emit("echo", null, new AckWithTimeout(3000) {
			@Override
			public void onSuccess(Object... args) {
				log.info(args[0].toString());	
			}
			@Override
			public void onTimeout() {
				log.warn("WARN: timout occured...");
			}
		});

Platform:

  • MacOS or any...

Error
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:966)
at java.util.LinkedList$ListItr.next(LinkedList.java:888)
at io.socket.client.Socket$6$1.run(Socket.java:232)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

Fix needed
Need to rewrite Socket.class to support thread-safe????
while (iterator.hasNext()) {
if (iterator.next().id == ackId) { <=== 232
iterator.remove();
}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions