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

Kernel.system fails to write stdout to a file in a Linux environment. #4598

Open
erikogan opened this issue May 10, 2017 · 1 comment
Open

Comments

@erikogan
Copy link

I don’t strictly think this is a bug in jRuby, exactly, since it breaks across environments. However I’m having a hard time reasoning about what could be going on. And it’s happening on a server that’s hard to debug.

Environments

The following behavior is different across two environments running jRuby 9.1.8.0:

It works on:

jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.60-b23 on 1.8.0_60-b27 +jit [darwin-x86_64]

OSX: (Darwin Ilarnek.local 15.6.0 Darwin Kernel Version 15.6.0: Fri Feb 17 10:21:18 PST 2017; root:xnu-3248.60.11.4.1~1/RELEASE_X86_64 x86_64)

and fails on:

jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.51-b03 on 1.8.0_51-b16 +jit [linux-x86_64]

Amazon Linux: (Linux export-service-worker-0bc3106f0a0098066 4.1.10-17.31.amzn1.x86_64 #1 SMP Sat Oct 24 01:31:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux)

In both cases I’m running a simple irb with JRUBY_OPTS=''

Expected Behavior

On the Darwin machine, it behaves the same way MRI does:

irb(main):003:0> system('pwd', chdir: '/etc', out: '/tmp/java_issue') && File.read('/tmp/java_issue')
=> "/etc\n"

Actual Behavior

In the Linux environment, it fails to write stdout to the file (though it still returns true, it is the File.read that is throwing the exception.)

irb(main):001:0> system('pwd', chdir: '/etc', out: '/tmp/java_issue') && File.read('/tmp/java_issue')
Errno::ENOENT: No such file or directory - /tmp/java_issue
        from org/jruby/RubyIO.java:3583:in `read'
        from (irb):1:in `<eval>'
        from org/jruby/RubyKernel.java:1000:in `eval'
        from org/jruby/RubyKernel.java:1298:in `loop'
        from org/jruby/RubyKernel.java:1120:in `catch'
        from org/jruby/RubyKernel.java:1120:in `catch'
        from /usr/local/rbenv/versions/jruby-9.1.8.0/bin/irb:13:in `<main>'

I may try to match Java versions, just to see if it is a bug that has been patched, but it is puzzling.

@erikogan
Copy link
Author

On the plus side, I’ve repoduced this issue in a container running on my laptop, which will make things slightly easier to debug.

The downside is that it still happens in that container even on the latest Java 1.8 available: jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [linux-x86_64]

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

No branches or pull requests

1 participant