Skip to content
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

Issue with EventThread and class loaders #116

Open
ustramooner opened this issue Aug 10, 2023 · 0 comments
Open

Issue with EventThread and class loaders #116

ustramooner opened this issue Aug 10, 2023 · 0 comments

Comments

@ustramooner
Copy link

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant