-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
I have noticed a file descriptor leak when running Rails with Mongoid 3 on a jruby/tomcat setup.
In my setup, it appears that tomcat only reuses threads for about 30 requests. On thread shutdown, the default session never closes. This results in 3 file descriptors (primary, secondary, and arbiter) being leaked every time a thread is shutdown. See https://github.com/jruby/jruby-rack/issues/118 for more details.
To solve this problem generally, I suspect mongoid 3 needs connection pooling. Since I am running with multiple runtimes in non-threadsafe mode, I am going to try a workaround where I assign the default session to a global variable instead of a thread-local variable (see https://github.com/tolsen/mongoid/commit/ea11a6ed651fd7323075106a77933dd926a70fea ). If you like, you might want to offer such a non-threadsafe option as a quick fix.
Tim