You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2020/04/06 09:48:45 UTC
[Bug 64311] New:
org.apache.tomcat.jni.TestSocketServerAnyLocalAddress locks entire testbed
run under certain conditions
https://bz.apache.org/bugzilla/show_bug.cgi?id=64311
Bug ID: 64311
Summary: org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
locks entire testbed run under certain conditions
Product: Tomcat 10
Version: 10.0.0-M3
Hardware: All
OS: FreeBSD
Status: NEW
Severity: major
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: michaelo@apache.org
Target Milestone: ------
This took me a bit to find. Following happens with:
* Tomcat master/4d5048f9826627ad9f80627bf28ff7b15bd489ac
* Tomcat native from master
* APR from 1.7.x w/o threading support, testing a patch for Bug 63671
* OpenSSL 1.1.1e-freebsd
* OpenJDK 64-Bit Server VM (build 25.242-b07, mixed mode)
* FreeBSD 12.1-STABLE #0 r359195, amd64
* Network settings:
> bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
> options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
> ether 20:67:7c:d4:58:40
> inet 147.54.64.17 netmask 0xfffffc00 broadcast 147.54.67.255
> inet 147.54.64.149 netmask 0xffffffff broadcast 147.54.64.149
> media: Ethernet autoselect (1000baseT <full-duplex>)
> status: active
> nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
> options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
> inet6 ::1 prefixlen 128
> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
> inet 127.0.0.1 netmask 0xff000000
> groups: lo
> nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
* build.properties contains:
> execute.test.apr=true
> java.net.preferIPv4Stack=true
When the test is started, it completely locks up. No progress. What happens:
* APR binds on any socket, in this case it is:
> $ procstat -f 33340
> 33340 java 21 s - rw------ 2 0 TCP 0 0 ::.22303 ::.0
* I have applied the following patch to tackle it down:
> diff --git a/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java b/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
> index 866ba772c5..3e56ebeff3 100644
> --- a/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
> +++ b/test/org/apache/tomcat/jni/TestSocketServerAnyLocalAddress.java
> @@ -127,0 +128 @@ public class TestSocketServerAnyLocalAddress extends AbstractJniTest {
> + System.out.println("Connecting to: " + connectAddress);
> @@ -164,0 +166 @@ public class TestSocketServerAnyLocalAddress extends AbstractJniTest {
> + System.out.println("Listenting at: " + localAddress);
> @@ -188,0 +191 @@ public class TestSocketServerAnyLocalAddress extends AbstractJniTest {
> + System.out.println("from enumeration");
> @@ -197,0 +201 @@ public class TestSocketServerAnyLocalAddress extends AbstractJniTest {
> + System.out.println("from loopback");
> @@ -200,0 +205 @@ public class TestSocketServerAnyLocalAddress extends AbstractJniTest {
> + System.out.println("from linklocal");
> @@ -203,0 +209 @@ public class TestSocketServerAnyLocalAddress extends AbstractJniTest {
> + System.out.println("from localhost");
I see then:
> test-nio2:
> [junit] Running org.apache.tomcat.jni.TestSocketServerAnyLocalAddress in thread 1
> [junit] Listenting at: /0:0:0:0:0:0:0:0:22303
> [junit] java.net.ConnectException: Connection refused (Connection refused)
> [junit] from localhost
> [junit] at java.net.PlainSocketImpl.socketConnect(Native Method)
> [junit] Connecting to: localhost/127.0.0.1:22303
> [junit] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
> [junit] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
> [junit] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
> [junit] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
> [junit] at java.net.Socket.connect(Socket.java:607)
> [junit] at org.apache.tomcat.jni.TestSocketServerAnyLocalAddress$Client.run(TestSocketServerAnyLocalAddress.java:129)
As soon as I disable the IPv4 preference the connection works on IPv6. Or this
one works with the 10-second timeout:
> $ nc -6 :: 64054
Suprisingly, as soon as I recompile the same APR version with threading support
the behavior of APR changes:
> test-nio2:
> [junit] Running org.apache.tomcat.jni.TestSocketServerAnyLocalAddress in thread 1
> [junit] Listenting at: /0.0.0.0:20726
> [junit] from enumeration
> [junit] Connecting to: /147.54.64.149:20726
> [junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0,03 sec, Thread: 1, Class: org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
So I see two bugs here:
* Tomcat test code does not properly handle APR on IPv6, but Java preference on
IPv4
* APR should not change its behavior when threading is disabled or a bug in
libtcnative?
Another compilation of APR: --disable-ipv6 --disable-threads make this run
again.
Positive findings:
* Almost all tests work w/ OpenSSL 1.1.1 and APR 1.7.x with threads disabled
and IPv6 disabled, java.net.preferIPv4Stack=false, except those:
> org.apache.catalina.session.TestStandardSessionIntegration:
> org.apache.catalina.tribes.group.TestGroupChannelMemberArrival:
> org.apache.catalina.tribes.group.TestGroupChannelStartStop:
> org.apache.catalina.tribes.group.interceptors.TestOrderInterceptor:
> org.apache.catalina.tribes.group.interceptors.TestTcpFailureDetector:
> org.apache.catalina.tribes.ChannelException: java.net.SocketException: Invalid argument; No faulty members identified.
> Caused by: java.net.SocketException: Invalid argument
> at java.net.PlainDatagramSocketImpl.join(Native Method)
> at java.net.AbstractPlainDatagramSocketImpl.join(AbstractPlainDatagramSocketImpl.java:178)
But this is due to: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193246
* With java.net.preferIPv4Stack=true all tests pass!
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64311] org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
locks entire testbed run under certain conditions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64311
--- Comment #7 from Michael Osipov <mi...@apache.org> ---
What do you think about the erratic behavior of APR in regards of the address
family when this feature is enabled or disabled? Our fault or APR's?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64311] org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
locks entire testbed run under certain conditions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64311
--- Comment #6 from Mark Thomas <ma...@apache.org> ---
Yes, I think that check is safe to remove.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64311] org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
locks entire testbed run under certain conditions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64311
--- Comment #5 from Michael Osipov <mi...@apache.org> ---
Since all tests pass, this check for threading support can be dropped sooner or
later? The threading support is required for OpenSSL < 1.1.0 only.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64311] org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
locks entire testbed run under certain conditions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64311
--- Comment #2 from Michael Osipov <mi...@apache.org> ---
(In reply to Mark Thomas from comment #1)
> I'm struggling to recreate this.
>
> I have APR 1.7.x compiled with --disable-threads
> I have Tomcat-Native at 57da160 (just before the fix for BZ 63671)
> I have tomcat master (current HEAD)
>
> The tests fail because of this test:
> https://github.com/apache/tomcat/blob/master/java/org/apache/tomcat/jni/
> Library.java#L251
>
> which has been present for 14+ years.
>
> How did you manage to run the test with APR threading disabled?
My bad, I forgot to mention this. I have removed the if clause to see whether
Tomcat really requires this. It obviously don't. Only OpenSSL < 1.1.0 requires
the threading support.
Please remove that check and try again.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64311] org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
locks entire testbed run under certain conditions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64311
--- Comment #3 from Mark Thomas <ma...@apache.org> ---
Ah. That explains it. I can reproduce this now. I've fixed the hang on failure.
I'll look at the failure next.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64311] org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
locks entire testbed run under certain conditions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64311
--- Comment #1 from Mark Thomas <ma...@apache.org> ---
I'm struggling to recreate this.
I have APR 1.7.x compiled with --disable-threads
I have Tomcat-Native at 57da160 (just before the fix for BZ 63671)
I have tomcat master (current HEAD)
The tests fail because of this test:
https://github.com/apache/tomcat/blob/master/java/org/apache/tomcat/jni/Library.java#L251
which has been present for 14+ years.
How did you manage to run the test with APR threading disabled?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 64311] org.apache.tomcat.jni.TestSocketServerAnyLocalAddress
locks entire testbed run under certain conditions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64311
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Fixed in:
- master for 10.0.0-M5 onwards
- 9.0.x for 9.0.35 onwards
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org