Skip to content

Possible Ack leak #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jesuspal opened this issue Aug 3, 2017 · 4 comments
Open

Possible Ack leak #446

jesuspal opened this issue Aug 3, 2017 · 4 comments

Comments

@jesuspal
Copy link

jesuspal commented Aug 3, 2017

We're using the socket.io-client v1.0.0 in our Android project. Having a connection open we've noticed sometimes when internet connectivity is lost the following error happens:

io.socket.engineio.client.EngineIOException: websocket error
io.socket.engineio.client.Transport.onError(Transport.java:63)
io.socket.engineio.client.transports.WebSocket.access$400(WebSocket.java:24)
io.socket.engineio.client.transports.WebSocket$1$5.run(WebSocket.java:107)
io.socket.thread.EventThread$2.run(EventThread.java:80)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
java.lang.Thread.run(Thread.java:818)

That leads to the socket getting disconnected, reason being transport error
The issue we've identified is upon a reconnection (once internet connectivity is available again) some of the registered Acks will never get notified (they remain indefinitely in the internal acks map in io.socket.client.Socket). It seems some of the packets for those Acks do not reach the server, in other cases they actually do but it's the response that gets lost.

These are our socket options:
IO.Options opts = new IO.Options(); opts.secure = true; opts.forceNew = true; opts.reconnection = true; opts.reconnectionAttempts = MAX_RECONNECTS; opts.reconnectionDelay = 2000; opts.transports = new String[]{"websocket"}; opts.upgrade = true; Socket socket = IO.socket(socketUrl, opts);

@chenguozhi
Copy link

Hello, did you solve it later?

@pal-tgiannakopoulos
Copy link

Hello, this was not resolved, we have done some kind of workaround to not rely on receiving the response

@chenguozhi
Copy link

Can you elaborate on that? I am very sad now.

@pal-tgiannakopoulos
Copy link

Nothing to elaborate really. Our fix is specific to our app and is not fixing the issue but rather the result logic. Previously we relied upon not losing an Ack (the normal case) and now we have worked on a separate confirmation logic by implementing our own timeout and retrying in case of an error.

Still waiting for a fix to this

darrachequesne added a commit that referenced this issue Jul 10, 2024
Previously, getting disconnected while waiting for an acknowledgement
would create a memory leak, as the acknowledgement was never received
and the handler would stay in memory forever.

See also: socketio/socket.io-client@34cbfbb

Related: #446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants