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

org.eclipse.jetty.websocket.servlet.WebSocketServlet cleanup #5851

Closed
VasilVasilev93 opened this issue Jan 4, 2021 · 2 comments
Closed

org.eclipse.jetty.websocket.servlet.WebSocketServlet cleanup #5851

VasilVasilev93 opened this issue Jan 4, 2021 · 2 comments
Assignees

Comments

@VasilVasilev93
Copy link

Jetty version
9.4.30.v20200611

Description
Hello and happy new year, wish you all the best!
Ater using websocket-servlet in osgi environment, I found that a single instance of org.eclipse.jetty.websocket.servlet.WebSocketServletFactory always remains in memory after uninstall of the bundle jar. Looking at the code it seems that the factory object is not getting removed from the context's attributes map. Inside the init method:
ctx.setAttribute(WebSocketServletFactory.class.getName(), factory);

In the destroy method only factory.stop(); gets called. If we also remove it from the context's attributes map, the object gets cleaned up. We have that fixed in our product, but I wonder if it's intended or a miss.

lachlan-roberts added a commit that referenced this issue Jan 5, 2021
@lachlan-roberts
Copy link
Contributor

I think the ServletContext attributes should be cleared when the context is stopped, so if you're getting to destroy then the attributes should be cleared shortly after. @janbartel any idea why this would be happening?

Your suggested cleanup sounds reasonable so I will put a PR up for this, thanks.

lachlan-roberts added a commit that referenced this issue Jan 20, 2021
…etCleanup

Issue #5851 - remove WebSocketServletFactory as ServletContext attribute on destroy
@lachlan-roberts
Copy link
Contributor

We now remove the WebSocketServletFactory ServletContext attribute in the destroy method.

This was referenced Mar 10, 2021
This was referenced Mar 10, 2021
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

2 participants