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 2021/06/30 10:20:41 UTC

[Bug 65410] New: TestXxxEndpoint testUnixDomainSocket fails with an Error on Windows 10, should be skipped

https://bz.apache.org/bugzilla/show_bug.cgi?id=65410

            Bug ID: 65410
           Summary: TestXxxEndpoint testUnixDomainSocket fails with an
                    Error on Windows 10, should be skipped
           Product: Tomcat 9
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: knst.kolinko@gmail.com
  Target Milestone: -----

Testing release candidate of Tomcat 9.0.50,
when running with Java 16 on Windows 10, the following test fails with NIO
connector:

org.apache.tomcat.util.net.TestXxxEndpoint#testUnixDomainSocket

Notes:

1. This test is skipped when running with version of Java earlier than java 16.
This test is skipped for any connector implementation besides NIO.

2. I think this failure is expected on Windows,
so there is one more condition to check before skipping the test.


3. I wonder, why this feature is not implemented for NIO2 connector.
- It is implemented for NIO. (via original PR, since 9.0.42)
- It is implemented for APR. (via bug 64943, since 9.0.47)

Searching through the source code, "unixDomainSocketPath" properties are
implemented in
- AprEndpoint,
- NioEndpoint.

4. Missing docs: "unixDomainSocketPath", "unixDomainSocketPathPermissions"
attributes are documented for the Nio connector only. They are not documented
for the APR connector.
https://tomcat.apache.org/tomcat-9.0-doc/config/http.html

5. I wonder, why this test is skipped for an APR connector,
if it implements the feature.


The Error with the test looks like the following (Tomcat 9.0.50, OpenJDK
16.0.1):

[[[
Testsuite: org.apache.tomcat.util.net.TestXxxEndpoint
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2,621 sec
------------- Standard Error -----------------
30-Jun-2021 00:28:34.827 INFO [main]
org.apache.catalina.startup.LoggingBaseTest.setUp Starting test case
[testUnixDomainSocket]
30-Jun-2021 00:28:35.323 INFO [main] org.apache.coyote.AbstractProtocol.init
Initializing ProtocolHandler ["http-nio-/tmp/testUnixDomainSocket"]
30-Jun-2021 00:28:35.355 SEVERE [main]
org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to
initialize component [Connector[HTTP/1.1-/tmp/testUnixDomainSocket]]
        org.apache.catalina.LifecycleException: Protocol handler initialization
failed
                at
org.apache.catalina.connector.Connector.initInternal(Connector.java:1049)
                at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
                at
org.apache.catalina.core.StandardService.initInternal(StandardService.java:561)
                at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
                at
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1049)
                at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
                at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
                at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)
                at
org.apache.catalina.startup.TomcatBaseTest$TomcatWithFastSessionIDs.start(TomcatBaseTest.java:878)
                at
org.apache.tomcat.util.net.TestXxxEndpoint.testUnixDomainSocket(TestXxxEndpoint.java:209)
                at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
                at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.base/java.lang.reflect.Method.invoke(Method.java:567)
                at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
                at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
                at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
                at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
                at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
                at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
                at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
                at
org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
                at
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
                at
org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
                at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
                at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
                at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
                at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
                at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
                at
org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
                at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
                at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
                at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
                at
org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
                at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
                at
junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:50)
                at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:535)
                at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1197)
                at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1042)
        Caused by: java.net.SocketException: Network is down: bind
                at java.base/sun.nio.ch.UnixDomainSockets.bind0(Native Method)
                at
java.base/sun.nio.ch.UnixDomainSockets.bind(UnixDomainSockets.java:111)
                at
java.base/sun.nio.ch.ServerSocketChannelImpl.unixBind(ServerSocketChannelImpl.java:319)
                at
java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:292)
                at
org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:250)
                at
org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:227)
                at
org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1208)
                at
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1221)
                at
org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:603)
                at
org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:80)
                at
org.apache.catalina.connector.Connector.initInternal(Connector.java:1046)
                ... 38 more
[...]
------------- ---------------- ---------------

Testcase: testUnixDomainSocket took 1,117 sec
        Caused an ERROR
Network is down: connect
java.net.SocketException: Network is down: connect
        at java.base/sun.nio.ch.UnixDomainSockets.connect0(Native Method)
        at
java.base/sun.nio.ch.UnixDomainSockets.connect(UnixDomainSockets.java:146)
        at
java.base/sun.nio.ch.UnixDomainSockets.connect(UnixDomainSockets.java:142)
        at
java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:849)
        at
org.apache.tomcat.util.net.TestXxxEndpoint.testUnixDomainSocket(TestXxxEndpoint.java:214)
        at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
        at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Testcase: testStartStopBindOnStart took 1,131 sec
Testcase: testStartStopBindOnInit took 0,304 sec
]]]

-- 
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 65410] TestXxxEndpoint testUnixDomainSocket fails with an Error on Windows 10, should be skipped

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65410

--- Comment #4 from Konstantin Kolinko <kn...@gmail.com> ---
> commit f06f99c90f4b8dcfa8c350cc97f781bc399f84ef
> AuthorDate: Wed Jun 30 17:45:20 2021 +0200
> Portable temp path code

Wow. It was the path.
The recent commit (cited above) fixes the issue: the test completes
successfully on Windows 10. (9.0.x, Java 16.0.1)


[[[
Testsuite: org.apache.tomcat.util.net.TestXxxEndpoint
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10,033 sec
------------- Standard Error -----------------
30-Jun-2021 19:25:48.116 INFO [main]
org.apache.catalina.startup.LoggingBaseTest.setUp Starting test case
[testUnixDomainSocket]
30-Jun-2021 19:25:50.882 INFO [main] org.apache.coyote.AbstractProtocol.init
Initializing ProtocolHandler
["http-nio-C:\\Users\\username-censored\\AppData\\Local\\Temp\\tomcat1743897028267623289.uds"]
30-Jun-2021 19:25:50.938 INFO [main]
org.apache.catalina.core.StandardService.startInternal Starting service
[Tomcat]
30-Jun-2021 19:25:50.938 INFO [main]
org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine:
[Apache Tomcat/9.0.38-dev]
30-Jun-2021 19:25:51.168 INFO [main] org.apache.coyote.AbstractProtocol.start
Starting ProtocolHandler
["http-nio-C:\\Users\\username-censored\\AppData\\Local\\Temp\\tomcat1743897028267623289.uds"]
30-Jun-2021 19:25:52.198 INFO [main] org.apache.coyote.AbstractProtocol.pause
Pausing ProtocolHandler
["http-nio-C:\\Users\\username-censored\\AppData\\Local\\Temp\\tomcat1743897028267623289.uds"]
30-Jun-2021 19:25:52.208 INFO [main]
org.apache.catalina.core.StandardService.stopInternal Stopping service [Tomcat]
30-Jun-2021 19:25:52.219 INFO [main] org.apache.coyote.AbstractProtocol.stop
Stopping ProtocolHandler
["http-nio-C:\\Users\\username-censored\\AppData\\Local\\Temp\\tomcat1743897028267623289.uds"]
30-Jun-2021 19:25:52.255 INFO [main] org.apache.coyote.AbstractProtocol.destroy
Destroying ProtocolHandler
["http-nio-C:\\Users\\username-censored\\AppData\\Local\\Temp\\tomcat1743897028267623289.uds"]

[...]
------------- ---------------- ---------------

Testcase: testUnixDomainSocket took 4,823 sec
Testcase: testStartStopBindOnStart took 4,771 sec
Testcase: testStartStopBindOnInit took 0,369 sec
]]]

-- 
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 65410] TestXxxEndpoint testUnixDomainSocket fails with an Error on Windows 10, should be skipped

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65410

Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Remy Maucherat <re...@apache.org> ---
Great !

-- 
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 65410] TestXxxEndpoint testUnixDomainSocket fails with an Error on Windows 10, should be skipped

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65410

Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Remy Maucherat <re...@apache.org> ---
This is not so simple. UDS is supposed to be supported on Windows by the JVM,
but the support might be partial. So not sure what's going on. The trace and
the "Network is down" does seem to me the JVM is trying but a needed subsystem
is not enabled (??).

-- 
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 65410] TestXxxEndpoint testUnixDomainSocket fails with an Error on Windows 10, should be skipped

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65410

--- Comment #3 from Remy Maucherat <re...@apache.org> ---
(In reply to Konstantin Kolinko from comment #2)
> I wonder whether the path matters.
> 
> The test uses file path "/tmp/testUnixDomainSocket", and "/tmp/" does not
> exist here.
> 
> BTW, as the path is not unique (not random), several parallel runs of this
> test may conflict with each other. (e.g. when testing different branches of
> Tomcat in parallel)

That would be a good point, this needs to be written in a more portable way.

-- 
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 65410] TestXxxEndpoint testUnixDomainSocket fails with an Error on Windows 10, should be skipped

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65410

--- Comment #2 from Konstantin Kolinko <kn...@gmail.com> ---
I wonder whether the path matters.

The test uses file path "/tmp/testUnixDomainSocket", and "/tmp/" does not exist
here.

BTW, as the path is not unique (not random), several parallel runs of this test
may conflict with each other. (e.g. when testing different branches of Tomcat
in parallel)

-- 
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