Forum: JRuby Intermittent Bad File Descriptor on close

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Matt Hauck (Guest)
on 2013-05-16 23:27
(Received via mailing list)
Hello folks. I have recently upgraded from to 1.7.3, and am
seeing a strange intermittent Bad File Descriptor error on closing a
file. The offending line is a simple "" (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.

- 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:

>     org/jruby/ `find'
>     config/boot.rb:7:in `(root)'

Basically, it throws a Errno::EBADF when trying to 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, 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
would expect this means there's a double-close happening somewhere, but
it's hard to tell.

- Charlie
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
This topic is locked and can not be replied to.