Gottox / socket.io-java-client

Socket.IO Client Implementation in Java
MIT License
950 stars 387 forks source link

Problem with Garbage collector #108

Closed Rainnwind closed 10 years ago

Rainnwind commented 10 years ago

I'm having a problem with the garbage collector when I try to disconnect a socket.

When disconnecting the socket after a period of time the garbage collector starts running indefinitely.

As far as I can see, the problem starts somewhere here:

IOConnection.java public synchronized void unregister(SocketIO socket) { sendPlain("0::" + socket.getNamespace()); sockets.remove(socket.getNamespace()); socket.getCallback().onDisconnect();

if (sockets.size() == 0) {
    cleanup();
}

}

Besides this everything seems to be working like a charm!

Rainnwind commented 10 years ago

I solved in by looking at: "Hangs CPU and takes whole mem" #52

"This is actually a bug in the Java-WebSocket library that this lib uses. You can fix it by updating Java-WebSocket to 1.3.0:

git clone git@github.com:TooTallNate/Java-WebSocket.git cd Java-WebSocket git checkout tags/Java-WebSocket-1.3.0 ant jar cp dist/java_websocket.jar [path to socket.io-java-client]/libs/WebSocket.jar rebuild the socket.io-java-client lib as usual"

Thanks to fiskbil