[8u] RFR: 8187450: JNI local refs exceeds capacity warning in NetworkInterface::getAll
Andrew Hughes
gnu.andrew at redhat.com
Wed Jul 21 17:18:52 UTC 2021
On 09:58 Thu 25 Mar , Jonathan Dowland wrote:
> Good morning,
>
> I'm requesting a review of a backport of JDK-8187450 to 8u.
>
> The patch (from 11u backport) does not apply cleanly, just one hunk due
> to extra #if defined(AF_INET6) in the context.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8187450
> Webrev: https://cr.openjdk.java.net/~jdowland/webrevs/JDK-8187450/webrev.jdk8u.00/
>
> Testing notes:
>
> test/java/net/NetworkInterface/Test.java passes.
>
> I had two tier1 failures that I am confident are unrelated, and also
> fail for me against a known-good 8u:
>
> tools/javac/diags/CheckExamples.java: provide examples of code that generate diagnostics
> tools/javac/fatalErrors/NoJavaLangTest.java: Verify that the compiler does not crash when java.lang is not
> they fail with jtreg
>
> The rest of tier1 passed.
>
> If you want to check out the impact this change makes, on a Linux host
> you can use network namespaces to isolate the number of network
> interfaces that are visible to Java, and steadily add more (virtual)
> interfaces. There are some shell script snippets in the original GitHub
> PR that might be useful:
>
> https://github.com/openjdk/jdk/pull/2963
>
> My results comparing before/after this patch for 8u are
>
> baseline, 2 network interfaces sufficient to breach the local refs limit:
>
> $ sudo ip netns exec jbase ip link show | grep UP | wc -l
> 2
> $ sudo ip netns exec jbase $JAVA_HOME/bin/java -Xcheck:jni NITest
> WARNING: JNI local refs: 33, exceeds capacity: 32
> at java.net.NetworkInterface.getAll(Native Method)
> at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:355)
> at NITest.main(NITest.java:4)
>
> after patch, the first local refs breach occurs with 5 interfaces:
>
> ...
> $ ./addif.sh 4
> 5 interfaces
> $ sudo ip netns exec jbase $JAVA_HOME/bin/java -Xcheck:jni NITest
> WARNING: JNI local refs: 33, exceeds capacity: 32
> at java.net.NetworkInterface.getAll(Native Method)
> at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:355)
> at NITest.main(NITest.java:4)
>
> after patch, it takes 10 interfaces to breach the next limit
>
> ...
> $ ./addif.sh 9
> 10 interfaces
> $ sudo ip netns exec jbase $JAVA_HOME/bin/java -Xcheck:jni NITest
> WARNING: JNI local refs: 33, exceeds capacity: 32
> at java.net.NetworkInterface.getAll(Native Method)
> at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:355)
> at NITest.main(NITest.java:4)
> WARNING: JNI local refs: 66, exceeds capacity: 65
> at java.net.NetworkInterface.getAll(Native Method)
> at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:355)
> at NITest.main(NITest.java:4)
>
>
> --
> Jonathan Dowland <jdowland at redhat.com>
> Senior Software Engineer, OpenJDK, Red Hat
>
Backport looks fine to me. Pretty much close to clean.
Thanks,
--
Andrew :)
Pronouns: he / him or they / them
Senior Free Java Software Engineer
OpenJDK Package Owner
Red Hat, Inc. (http://www.redhat.com)
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
More information about the jdk8u-dev
mailing list