Skip to content

Issue with EventThread and class loaders #116

Open
@ustramooner

Description

@ustramooner

I have an issue i've been trying to solve in a somewhat strange environment. I'm using the socket client to connect to a WebSocket, but the code is kept inside it's own class loader. When the socket client is terminated the class loader is unloaded. But there's a situation where the EventThread is not completed and therefore when the WebSocket comes to running the executing the work, the class loader has unloaded this class along with all the socket io classes so I get a NoClassDefFoundError. Because of the way the parent is implemented (and this can't be changed), I need to fix this issue in the EventThread.

  • Firstly, I haven't manged to reproduce this code in a clean environment. It's a little complicated because of the use of class loaders.
  • The approach I've taken is to add a shutdown function to the EventThread - which mostly works. https://github.com/ustramooner/engine.io-client-java/tree/clean-shutdown - i can create a PR if you'd like me to so that it can be reviewed - I didn't want to do it without creating an issue here first though
  • Finally, although this is one approach to solving the issue, getting the WebSocket to shutdown cleanly would be even better. From my research it seems that although you shut down the 'client socket', the 'engine socket' remains opened for a bit longer. It may be a better way of solving it, but I couldn't find a clean way of solving it due to the dependencies between the client and engine code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions