socket.io-client-java
socket.io-client-java copied to clipboard
Possible Ack leak
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);
Hello, did you solve it later?
Hello, this was not resolved, we have done some kind of workaround to not rely on receiving the response
Can you elaborate on that? I am very sad now.
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