Skip to content

java.net.preferIPv4Stack=true warning not possible to disable on OpenBSD #5057

@jeremyevans

Description

@jeremyevans

Environment

JRuby version: jruby 9.1.16.0 (2.3.3) 2018-02-21 8f3f95a OpenJDK 64-Bit Server VM 25.144-b01 on 1.8.0_144-b01 +jit [OpenBSD-x86_64]
Operating system: OpenBSD/amd64 6.2-current

Expected Behavior

$ jruby -r socket -e 'p 1'
1

Actual Behavior

$ jruby -r socket -e 'p 1'
2018-02-21T13:52:40.076-08:00 [main] WARN Ruby : Warning: not setting network stack system property because socket subsystem may already be booted.If you need this option please set it manually as a JVM property.
Use JAVA_OPTS=-Djava.net.preferIPv4Stack=true OR prepend -J as a JRuby option.
1

Let's say I try to take the advice it gives:

$ jruby -J-Djava.net.preferIPv4Stack=true -r socket -e 'p 1'
2018-02-21T13:52:40.076-08:00 [main] WARN Ruby : Warning: not setting network stack system property because socket subsystem may already be booted.If you need this option please set it manually as a JVM property.
Use JAVA_OPTS=-Djava.net.preferIPv4Stack=true OR prepend -J as a JRuby option.
1
$ JAVA_OPTS=-Djava.net.preferIPv4Stack=true jruby -r socket -e 'p 1'
2018-02-21T13:52:40.076-08:00 [main] WARN Ruby : Warning: not setting network stack system property because socket subsystem may already be booted.If you need this option please set it manually as a JVM property.
Use JAVA_OPTS=-Djava.net.preferIPv4Stack=true OR prepend -J as a JRuby option.
1

Well that sucks. I can only get the warning to be suppressed if I use a setting of false instead of true:

testcurrent$ jruby -J-Djava.net.preferIPv4Stack=false -r socket -e 'p 1'
1
testcurrent$ JAVA_OPTS=-Djava.net.preferIPv4Stack=false jruby -r socket -e 'p 1'
1

However, that changes the behavior, since the OpenBSD OpenJDK default is true (see https://github.com/openbsd/ports/blob/master/devel/jdk/1.8/patches/patch-jdk_src_solaris_native_java_lang_java_props_md_c#L8-L10).

I believe this behavior broke in d55cd48, which was an attempt to fix #4869. Since I'm guessing you don't want to revert that, is there a way JRuby can be fixed so that it doesn't warn if the JDK defaults java.net.preferIPv4Stack to true?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions