trinopoty / socket.io-server-java

Socket.IO Server Library for Java
Other
179 stars 50 forks source link

Events are not received #17

Open lorenzobucci opened 3 years ago

lorenzobucci commented 3 years ago

We have developed a Java chatroom project that uses this Java library to implement the server and the socket.io java port for the client.

During development we realized that our tests fail randomly for no apparent reason: in fact, just restart them and there is no more failure. Obviously, whenever we were waiting for an event to be received we used a test library that waits for a preset timeout (usually 2 seconds) before failing the tests. This should give the events time to reach the client or the server.

Despite this we concluded that sometimes the events never reach their destination although they have been successfully sent. This happens in both directions: server to client and client to server.

Attached you will find a log of a tests run during which a test fails: test-failure.txt You can see that at line 23 the server sends the "msg" event but the client does not receive it for the next 2 seconds, so the test fails. We also tried to increase the timeout (e.g. 20 seconds) but the result is the same: the event is sent but never reaches its destination.

UPDATE: Here you can find a GitHub Actions workflow in which the problem reoccurred. I don't know why the timestamps are not sorted but you can understand that around line 1750 the server sends the "connected" event which is not received by the client for the next 2 seconds. If we try to restart the workflow, the problem will most likely not occur again.

trinopoty commented 3 years ago

I have noticed this issue in the test suite also. I'll diagnose the issue and publish a fix soon.

spencercjh commented 3 years ago

@trinopoty @lorenzobucci Such a very confusing problem makes it difficult for me to use it in a production environment. Is there any progress?

trinopoty commented 3 years ago

This is certainly a problem from the underlying engine.io library. But it's completely random and hard to diagnose.

kindlychung commented 2 years ago

Is there an issue for this in the engine.io repo?

Adithyakm commented 1 year ago

@trinopoty Events are not moving from server to client and client to server. Is this resolved or does it still exist?