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 9.0.1.0 tries to access O_NONBLOCK under Windows #3332

Closed
sudish opened this issue Sep 16, 2015 · 2 comments
Closed

JRuby 9.0.1.0 tries to access O_NONBLOCK under Windows #3332

sudish opened this issue Sep 16, 2015 · 2 comments

Comments

@sudish
Copy link

sudish commented Sep 16, 2015

The stack trace snippet at the end is under Windows 7, using jruby-complete 9.0.1.0 with Java 1.7.0_25.

The cause is this bit of code from https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyFile.java#L148

        if (    // O_NDELAY not defined in OpenFlags
                //OpenFlags.O_NDELAY.defined() ||
                OpenFlags.O_NONBLOCK.defined()) {
            if (!OpenFlags.O_NONBLOCK.defined()) {
//                #   define O_NONBLOCK O_NDELAY
            }
            /* do not block on open or for data to become available */
            constants.setConstant("NONBLOCK", runtime.newFixnum(OpenFlags.O_NONBLOCK.intValue()));
        } else if (Platform.IS_WINDOWS) {
            // FIXME: Should NONBLOCK exist for Windows fcntl flags?
            constants.setConstant("NONBLOCK", runtime.newFixnum(1));
        }

O_NONBLOCK isn't defined under Windows so the platform check should come first.

        if (Platform.IS_WINDOWS) {
            // FIXME: Should NONBLOCK exist for Windows fcntl flags?
            constants.setConstant("NONBLOCK", runtime.newFixnum(1));
        } else if (OpenFlags.O_NONBLOCK.defined()) {
            /* do not block on open or for data to become available */
            constants.setConstant("NONBLOCK", runtime.newFixnum(OpenFlags.O_NONBLOCK.intValue()));
        }

Thanks!

Original stack trace follows.

Caused by: java.lang.NoSuchMethodError: jnr.constants.platform.OpenFlags.defined()Z
        at org.jruby.RubyFile.createFileClass(RubyFile.java:148)
        at org.jruby.Ruby.initCore(Ruby.java:1551)
        at org.jruby.Ruby.bootstrap(Ruby.java:1336)
        at org.jruby.Ruby.init(Ruby.java:1227)
        at org.jruby.Ruby.newInstance(Ruby.java:330)
        at org.jruby.embed.internal.AbstractLocalContextProvider.getGlobalRuntime(AbstractLocalContexProvider.java:82)
        at org.jruby.embed.internal.SingletonLocalContextProvider.getRuntime(SingletonLocalContextProider.java:99)
        at org.jruby.embed.internal.BiVariableMap.getRuntime(BiVariableMap.java:108)
        at org.jruby.embed.internal.BiVariableMap.getTopSelf(BiVariableMap.java:240)
        at org.jruby.embed.internal.BiVariableMap.getReceiverObject(BiVariableMap.java:236)
        at org.jruby.embed.internal.BiVariableMap.put(BiVariableMap.java:331)
        at org.jruby.embed.internal.BiVariableMap.put(BiVariableMap.java:315)
        at org.jruby.embed.ScriptingContainer.put(ScriptingContainer.java:1166)
        at cucumber.runtime.jruby.JRubyBackend.<init>(JRubyBackend.java:54)
@headius
Copy link
Member

headius commented Jun 28, 2016

This is strange. The fix in #3958 is probably fine, but this error should not happen. NoMethodError only happens when code that previously compiled successfully now turns out to be calling a method that does not exist. In short, there has to be a version mismatch here; some older version of jnr-constants is getting into your environment.

@headius
Copy link
Member

headius commented Jul 11, 2016

Closing per @SquirrelGrip's report in #3958 that this can no longer be reproduced.

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

3 participants