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

Memory leak on JRuby #101

Closed
nirvdrum opened this issue Jan 3, 2013 · 4 comments
Closed

Memory leak on JRuby #101

nirvdrum opened this issue Jan 3, 2013 · 4 comments

Comments

@nirvdrum
Copy link

nirvdrum commented Jan 3, 2013

JRuby application servers that can do hot redeploys will shut down the old JRuby runtime without exiting the process. In a few places, rack-mini-profiler creates threads that won't shut down until the process dies. Each of these threads will cause a stopped JRuby runtime to sit around in memory much longer than necessary (they appear to be weakrefs and as such, should eventually be GC'd).

Rack::MiniProfiler::FileStore
Rack::MiniProfiler::MemoryStore

are definitely problematic.

Rack::MiniProfiler may be problematic. This one create a thread that can be exited under certain circumstances. I'd have to trace through to see when that happens.

The simple fix is to flag the thread in an at_exit handler. I did this for another project:

https://github.com/wr0ngway/lumber/blob/a35520abace41a87b455b15398be630e7ef5b2da/lib/lumber/level_util.rb#L83

If you're open to a similar solution I can pull together a pull request.

@SamSaffron
Copy link
Owner

Pull request totally welcome. Issue totally makes sense

@SamSaffron
Copy link
Owner

any news on this, I would like to wrap it up

@nirvdrum
Copy link
Author

Sorry, I had gotten roped into a separate bug in JRuby that's since been resolved, but I forgot to revisit this. I'll try to get to it this weekend.

@nirvdrum
Copy link
Author

I re-opened the issue on the new project with a pull request:

MiniProfiler/rack-mini-profiler#42

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