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

JRuby 1.7.24 - EBADF Bad file descriptor #3634

Closed
kimptoc opened this issue Feb 2, 2016 · 6 comments
Closed

JRuby 1.7.24 - EBADF Bad file descriptor #3634

kimptoc opened this issue Feb 2, 2016 · 6 comments

Comments

@kimptoc
Copy link

kimptoc commented Feb 2, 2016

Since switching to 1.7.24 (from 1.7.23), running on Windows with JDK 1.7.0_80-b15. Also run this on Linux and did not see the issue there.

On this line – a global constant is defined via the call to a function that returns a string. There is an identical call to the same method that is done in the parent class (run_integration_tests.rb, line 112)

FIX_MESSAGE_FILE = EmarketsCheckAdaptor::EmarketsFixConfig::fix_data_dictionary_file

If I move the constant into a class, it does not have a problem. Looks like I am no longer allowed to redefine constants .

10:53:38:332|0091-00038:TH3 ERROR: RunIntegrationTests:Errno::EBADF:Bad file descriptor - Bad file descriptor
10:53:38:333|0053-00038:TH3 INFO: org/jruby/RubyIO.java:1411:in `write'
10:53:38:333|0134-00038:TH3 INFO: C:/rbidev/IonPlatformPostMerge/config/RaboWriter/integration_tests/tests/test_emarkets_check_adaptor.rb:23:in `(root)'
10:53:38:333|0059-00038:TH3 INFO: org/jruby/RubyKernel.java:1040:in `require'
10:53:38:333|0196-00038:TH3 INFO: /C:/Users/kimptonc/.m2/repository/org/jruby/jruby-complete/1.7.24/jruby-complete-1.7.24.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54:in `require'
10:53:38:333|0152-00038:TH3 INFO: file:/C:/Users/kimptonc/.m2/repository/org/jruby/jruby-complete/1.7.24/jruby-complete-1.7.24.jar!/jruby/kernel19/kernel.rb:1:in `(root)'
10:53:38:333|0163-00038:TH3 INFO: file:/C:/Users/kimptonc/.m2/repository/org/jruby/jruby-complete/1.7.24/jruby-complete-1.7.24.jar!/jruby/kernel19/kernel.rb:13:in `require_relative'
10:53:38:333|0053-00038:TH3 INFO: org/jruby/RubyProc.java:281:in `call'
10:53:38:333|0123-00038:TH3 INFO: C:/rbidev/IonPlatformPostMerge/config/RaboWriter/integration_tests/run_integration_tests.rb:113:in `(root)'

I have changed the code to not make them global constants and that fixes things.

@headius
Copy link
Member

headius commented Mar 4, 2016

It sounds like you've worked around it, but can we see the code that caused this? I'm not sure where I could find "run_integration_tests.rb, line 112" or the other assignment of this constant, but I'd really like to figure out the root problem here. If we're not properly namespacing constants, that's a serious bug.

@kimptoc Can you provide more information?

@kimptoc
Copy link
Author

kimptoc commented Mar 4, 2016

Trying to reproduce it in a simple example, but failing - https://github.com/kimptoc/docker-jruby-ebadf-tester

The "only" difference between this and my app code (that I can still make fail with 1.7.24) is that instead of the requires happening off the main thread (via Thread.new ), its triggered via a third party (Java) lib that does the callback - but is then kicked off via Thread.new too.

@headius
Copy link
Member

headius commented Apr 20, 2016

@kimptoc Have you had any further success narrowing this down? I'm not sure how to reproduce this.

I suspect it's not a problem with assigning that constant, but that the stream getting assigned is somehow closed already. Given that moving the constant out of global namespace fixed this, perhaps some other code in your library/app is accessing that stream and closing it prematurely?

Bumping off 9.1 since we have no way to reproduce this issue right now.

@headius headius modified the milestones: JRuby 9.1.1.0, JRuby 9.1.0.0 Apr 20, 2016
@kimptoc
Copy link
Author

kimptoc commented Apr 21, 2016

Nope, no joy.

You'll be annoyed (or pleased?) to know that 1.7.25 does not have the problem ...

We've not moved this project onto 9k yet - just giving it a whirl in a small project at the moment, hopefully can move the main one over sooner than later.

Feel free to close this.

@headius
Copy link
Member

headius commented May 11, 2016

Since 1.7.25 does not exhibit the issue and we have no way to reproduce, I'm closing this as fixed in 1.7.25.

Please reopen if this same issue happens again.

@headius headius closed this as completed May 11, 2016
@headius headius modified the milestones: JRuby 1.7.25, JRuby 9.1.1.0 May 11, 2016
@kimptoc
Copy link
Author

kimptoc commented May 12, 2016

No problem, will do. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants