From nobody Wed Nov 08 14:35:18 2023 X-Original-To: java@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SQSKy2pmbz4ypyG for ; Wed, 8 Nov 2023 14:35:18 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SQSKy0tFzz4Ngf for ; Wed, 8 Nov 2023 14:35:18 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699454118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PydtFoid/vzBQKwWYhS9+ue9G2rc4GX8hzCp/i89x8s=; b=Hg+M+GS6mXXMVKQhJCMQnxtwhVp+2HNjCB5GxOoHQ9bQmb+PzyStmy8Wf4bxu80pkqaEar Kgj9TO+gkFv+k2keztCTRtJwZ7haunCTQvenJNJiKdf7ntKCbVpzaycDkZZiXcHRCueosX 0SEIFMdvnLFSrK9WQPNpIVFMRHX6gXbylevAhGXP38NgBKF6sbj6XdhmEF9YGCotgK8Q4C BTLUhOPbgxEwx4YvT0vHwc4MgsvIoljz6jdPLizQ0i0rDJMrmCDSH/++Z3MzPaYwauDySF 5VdifVLoGgN4roG5jZTmJPzGuYFbo+Ycmn4EnvuZzh/exdkPn4Lc9FRdU4pggw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699454118; a=rsa-sha256; cv=none; b=qflEN+xJHBAMC0SKgbSRnny9hheKWIFna7IwnEyPzVVABJ7WxuRX4Zn9VZRSvwL3XnPPkm jmcwt16kabYoF2DsBxCkPFglQt/kZVbyqUZvxH/9GfLiXSnu5BSNOvMA4f4DKBDdPm5RF6 dFZUdS8adjhaqL53yNX9Xmb4KUn4Bm/V72Kjy6em17uLciuM/OVRH5f+L3/hwRBNaWgqW+ vNgrVgZpOQQiHPs5+EFwloyKyjkmhn111G1T0DyYjm5kkt3OLa1qXog5Qxa7OngVoieqXm XA5nKq8iV9WJBD//qH8g/rM09QhyEfJ6iQsEj21iejr/zJV3N08RNGtA/qJGNQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SQSKx73TRzcfS for ; Wed, 8 Nov 2023 14:35:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 3A8EZHp0073735 for ; Wed, 8 Nov 2023 14:35:17 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 3A8EZHT3073734 for java@FreeBSD.org; Wed, 8 Nov 2023 14:35:17 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" From: bugzilla-noreply@freebsd.org To: java@FreeBSD.org Subject: maintainer-feedback requested: [Bug 274964] java/openjdk21 Dual-stack IPv4/IPv6 applications no longer work with sysctl net.inet6.ip6.v6only=1 Date: Wed, 08 Nov 2023 14:35:18 +0000 X-Bugzilla-Type: request X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: java@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? Message-ID: In-Reply-To: References: X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Porting Java to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-java List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-java@freebsd.org MIME-Version: 1.0 Bugzilla Automation has asked freebsd-java (Nobody) for maintainer-feedback: Bug 274964: java/openjdk21 Dual-stack IPv4/IPv6 applications no longer work with sysctl net.inet6.ip6.v6only=3D1 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D274964 --- Description --- We have a Tomcat-based application (with Tomcat configured to use the Apache Portable Runtime) that listens on both IPv4 and IPv6. Java is invoked with -Djava.net.preferIPv4Stack=3Dfalse to enable IPv6 support. This application works perfectly on FreeBSD with OpenJDK 17 and accepts both IPv4 and IPv6 connections, even though the FreeBSD 13.2-RELEASE-p3 host has= the default sysctl net.inet6.ip6.v6only=3D1 setting. The exact same application= and configuration fails to listen to IPv4 clients when deployed with OpenJDK 21. We have another JVM server application, this time created using Scala HTTP4s (https://http4s.org/), and thus not using the Apache Portable Runtime. This application (again run with -Djava.net.preferIPv4Stack=3Dfalse) exhibits the exact same behaviour: with OpenJDK 17, both IPv4 and IPv6 clients can conne= ct; with OpenJDK 21, only IPv6 clients can connect. The problem is thus not specific to the Apache Portable Runtime. Both applications work as expected with OpenJDK 21 if the FreeBSD host has sysctl net.inet6.ip6.v6only set to 0. However, setting sysctl net.inet6.ip6.v6only=3D0 is not required using OpenJDK 17. Both applications are running in FreeBSD jails, but I do not believe that is likely a factor. I am not sure whether I am looking at the relevant code or not, but the Fre= eBSD OpenJDK 17 port has BSD-specific code in src/java.base/unix/native/libnet/PlainSocketImpl.c that appears to set the IPV6_V6ONLY flag to 0 when opening a socket if IPv4 is available. See https://github.com/battleblow/jdk17u/blob/373026a81f5000e6df990eb9faec37f51= 8ee7 11e/src/java.base/unix/native/libnet/PlainSocketImpl.c#L184 The networking code appears to have been re-arranged in OpenJDK 21 (relativ= e to OpenJDK 17), so that particular source file no longer exists. However, a se= arch for IPV6_V6ONLY in the jdk21u GitHub repository does not reveal any plausib= le direct equivalent code. This explicit enabling of IPV6_V6ONLY when opening a socket in OpenJDK 17 may perhaps be the reason why OpenJDK 17 works for us without sysctl net.inet6.ip6.v6only=3D0 but OpenJDK 21 doesn=E2=80=99t. Note that we also tested the FreeBSD OpenJDK 18, 19, and 20 ports. Like Ope= nJDK 21, these also fail to work with our dual-stack applications. This issue is almost certainly related to the old OpenJDK 11 bug #239890, b= ut I am guessing that bug was obsolete as of OpenJDK 17, since the described scenario does seem to work there.