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

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

Closed
jeremyevans opened this Issue Feb 21, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@jeremyevans
Contributor

jeremyevans commented Feb 21, 2018

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?

@headius

This comment has been minimized.

Member

headius commented Feb 23, 2018

How did you install JRuby? You aren't passing that property and yet it is getting set somehow. That could mean it's using an older JRuby launcher script/executable that still tries to set it.

You may see the property being passed in bin/jruby if it's still a bash script.

@headius

This comment has been minimized.

Member

headius commented Feb 23, 2018

Ahh, I see the bug. The property we deprecated is defaulting to whatever the JDK uses for the preferIPv4Stack property, so when the JDK defaults to true we warn. Oops.

I'll fix.

Ugly workaround for now would be to set it to false at startup and then alter it (via ENV_JAVA) before booting the socket subsystem.

headius added a commit that referenced this issue Feb 23, 2018

@headius headius added this to the JRuby 9.1.17.0 milestone Feb 23, 2018

@headius headius closed this Feb 23, 2018

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