Forum: JRuby Intermittent Bad File Descriptor on close

6fffdf47ba23571d98546e0e990757d0?d=identicon&s=25 Matt Hauck (Guest)
on 2013-05-16 23:27
(Received via mailing list)
Hello folks. I have recently upgraded from 1.6.5.1 to 1.7.3, and am
seeing a strange intermittent Bad File Descriptor error on closing a
file. The offending line is a simple "File.read" (from
Gem::Specification::load). After searching for a bit and trying to dig
into the internals of RubyIO and RubyFile I figured I'd just ask you all
for some pointers.

Context:
- A rails application bundled as a war file with warbler
- A ruby script ("script/main") bundled together in that app which runs
some executable-type tasks
- Deployed onto a windows machine and run with IBM java
- A two step process of running script/main: (1) Launch a java process
that unzips the war file into a temporary directory; (2) Launch another
process that runs script/main via a ScriptingContainer.

It is during this last process, starting up the rails app, it chokes on
line 7 of boot.rb, which is this:


> require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
>
>

Here's the stacktrace from then on out:
>


>
jar:file:/C:/Users/qa/AppData/Local/Temp/war613215970041497838extract/WEB-INF/lib/jruby-stdlib-1.7.3.ibm.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:267:in
`_all'
>
jar:file:/C:/Users/qa/AppData/Local/Temp/war613215970041497838extract/WEB-INF/lib/jruby-stdlib-1.7.3.ibm.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:410:in
`each'
>     org/jruby/RubyEnumerable.java:563:in `find'
>
jar:file:/C:/Users/qa/AppData/Local/Temp/war613215970041497838extract/WEB-INF/lib/jruby-stdlib-1.7.3.ibm.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/specification.rb:442:in
`find_by_path'
>
jar:file:/C:/Users/qa/AppData/Local/Temp/war613215970041497838extract/WEB-INF/lib/jruby-stdlib-1.7.3.ibm.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems.rb:206:in
`try_activate'
>
jar:file:/C:/Users/qa/AppData/Local/Temp/war613215970041497838extract/WEB-INF/lib/jruby-stdlib-1.7.3.ibm.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:59:in
`require'
>     config/boot.rb:7:in `(root)'



Basically, it throws a Errno::EBADF when trying to File.read one of the
gemspec files unpacked from the war file. I have been trying to
reproduce with some debug output in specification.rb to try to figure
out which gemspec file it is, and to see if there is one particularly
offensive gemspec file, or if just fails randomly without pattern.

Any ideas on what might be causing this?
F1d37642fdaa1662ff46e4c65731e9ab?d=identicon&s=25 Charles Nutter (headius)
on 2013-05-17 16:56
(Received via mailing list)
Pretty complicated setup...

Is it possible for you to get a raw Java backtrace for this? The Java
property to set would be jruby.backtrace.style=RAW, which should give us
all the Java line numbers down to the actual exception.

This may be easy to fix if there's a way for us to reproduce it. Usually
I
would expect this means there's a double-close happening somewhere, but
it's hard to tell.

- Charlie
6fffdf47ba23571d98546e0e990757d0?d=identicon&s=25 Matt Hauck (Guest)
on 2013-05-17 22:56
(Received via mailing list)
Haha yeah…  I will turn on that flag and upgrade to 1.7.4 and see if can
reproduce it or not.

--
Matt Hauck
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.