Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.1
-
Fix Version/s: JRuby 1.6.2
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
JRuby 1.6.1
Ubuntu 10.04.1 LTS
-
Testcase included:yes
-
Number of attachments :
Description
Problem
It seems that JRuby has a file descriptor leak and it is related to the Net::HTTP methods.
To reproduce the bug, get https://github.com/ocher/jruby_file_leak_example and then:
bundle install
kirk -c Kirkfile
ab -n 100 -c 10 http://127.0.0.1:9090/test
- check number of pipes using:
- lsof -p KIRK_PID | grep pipe | wc -l
- redeploy kirk (kirk should display info that it's redeploying app. There is some problem with this on OSX):
touch REVISION- run ab once again, and check number of pipes
- after a few redeploys there should be plenty of opened pipes
ab -n 100 -c 10 http://127.0.0.1:9090/test
There is also an example lsof dump in github repo.
Trinidad has the same problem, so it's probably some general JRuby bug. On a big, heavaily used, long running Rails app number of pipes grow even without redeploying - it's the most problematic part of the bug.
Have you tried running the exact same test except not calling Net::HTTP.get in your "/test" handler? I'm wondering if this isn't a problem with Net::HTTP but just every request to the server leaving an open file and the current code makes the problem worse because each request spawns another request to the same server.
The only reason I suggest this is I know jruby-rack and TorqueBox have tracked down similar bugs in the past with each HTTP request leaving open files.