-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
21
How to reproduce the bug on Linux:
1. Open the /etc/hosts file and add "somehostname" like this:
127.0.0.1 somehostname localhost localhost.localdomain localhost4 localhost4.localdomain4
2. Run the make run-test TEST=test/jdk/java/net/httpclient/CancelRequestTest.java
The next exception will happen:
test CancelRequestTest.testPostInterrupt("http://127.0.0.1:43187/http1/x/same/interruptThread", true): success
config CancelRequestTest.beforeMethod(org.testng.TestRunner@54d6bee1): success
[10 s, 494 ms, 920108 ns] testPostInterrupt(https://127.0.0.1:39455/https1/x/same/interruptThread, true)
Sending: https://127.0.0.1:39455/https1/x/same/interruptThread/post/req=0
https://127.0.0.1:39455/https1/x/same/interruptThread/post/req=0: got result or exception
https://127.0.0.1:39455/https1/x/same/interruptThread/post/req=0: got IOException: javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching somehostname found.
https://127.0.0.1:39455/https1/x/same/interruptThread/post/req=0: unexpected exception: javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching somehostname found.
test CancelRequestTest.testPostInterrupt("https://127.0.0.1:39455/https1/x/same/interruptThread", true): failure
javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching somehostname found.
at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:956)
at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:133)
at CancelRequestTest.testPostInterrupt(CancelRequestTest.java:549)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:102)
at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:58)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching somehostname found.
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:130)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:378)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:316)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1318)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1195)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1138)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:393)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:476)t java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1273)
at java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1260)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
at java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask.run(SSLEngineImpl.java:1205)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate.lambda$executeTasks$3(SSLFlowDelegate.java:1132)
at java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(HttpClientImpl.java:177)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate.executeTasks(SSLFlowDelegate.java:1127)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate.doHandshake(SSLFlowDelegate.java:1093)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate$Reader.processData(SSLFlowDelegate.java:494)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate$Reader$ReaderDownstreamPusher.run(SSLFlowDelegate.java:269)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:182)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:207)
at CancelRequestTest$TestExecutor.lambda$execute$0(CancelRequestTest.java:143)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
... 1 more
Caused by: java.security.cert.CertificateException: No subject alternative DNS name matching somehostname found.
at java.base/sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:207)
at java.base/sun.security.util.HostnameChecker.match(HostnameChecker.java:103)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:457)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:417)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:291)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:144)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1296)
... 22 more
The test passed on JDK 20 and failed on JDK21.
The test passed if the repo updated to the commits before https://github.com/openjdk/jdk/commit/90b4006bce6a4c28f93297da06be3b30d02fa89f
But not sure that the commit is directly related to the exception. It could be the certs used by the test.
The list of affected tests:
java/net/httpclient/CancelRequestTest.java
java/net/httpclient/CookieHeaderTest.java
java/net/httpclient/HttpClientClose.java
java/net/httpclient/HttpClientShutdown.java
java/net/httpclient/HttpRedirectTest.java
java/net/httpclient/InvalidInputStreamSubscriptionRequest.java
java/net/httpclient/InvalidSubscriptionRequest.java
java/net/httpclient/RetryWithCookie.java
java/net/httpclient/ThrowingSubscribersAsInputStream.java
java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java
java/net/httpclient/ThrowingSubscribersAsLines.java
java/net/httpclient/ThrowingSubscribersAsLinesAsync.java
java/net/httpclient/ThrowingSubscribersAsString.java
java/net/httpclient/ThrowingSubscribersAsStringAsync.java
java/net/httpclient/UserCookieTest.java
1. Open the /etc/hosts file and add "somehostname" like this:
127.0.0.1 somehostname localhost localhost.localdomain localhost4 localhost4.localdomain4
2. Run the make run-test TEST=test/jdk/java/net/httpclient/CancelRequestTest.java
The next exception will happen:
test CancelRequestTest.testPostInterrupt("http://127.0.0.1:43187/http1/x/same/interruptThread", true): success
config CancelRequestTest.beforeMethod(org.testng.TestRunner@54d6bee1): success
[10 s, 494 ms, 920108 ns] testPostInterrupt(https://127.0.0.1:39455/https1/x/same/interruptThread, true)
Sending: https://127.0.0.1:39455/https1/x/same/interruptThread/post/req=0
https://127.0.0.1:39455/https1/x/same/interruptThread/post/req=0: got result or exception
https://127.0.0.1:39455/https1/x/same/interruptThread/post/req=0: got IOException: javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching somehostname found.
https://127.0.0.1:39455/https1/x/same/interruptThread/post/req=0: unexpected exception: javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching somehostname found.
test CancelRequestTest.testPostInterrupt("https://127.0.0.1:39455/https1/x/same/interruptThread", true): failure
javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching somehostname found.
at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:956)
at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:133)
at CancelRequestTest.testPostInterrupt(CancelRequestTest.java:549)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:102)
at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:58)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: javax.net.ssl.SSLHandshakeException: No subject alternative DNS name matching somehostname found.
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:130)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:378)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:316)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1318)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1195)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1138)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:393)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:476)t java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1273)
at java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1260)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
at java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask.run(SSLEngineImpl.java:1205)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate.lambda$executeTasks$3(SSLFlowDelegate.java:1132)
at java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(HttpClientImpl.java:177)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate.executeTasks(SSLFlowDelegate.java:1127)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate.doHandshake(SSLFlowDelegate.java:1093)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate$Reader.processData(SSLFlowDelegate.java:494)
at java.net.http/jdk.internal.net.http.common.SSLFlowDelegate$Reader$ReaderDownstreamPusher.run(SSLFlowDelegate.java:269)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:182)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:207)
at CancelRequestTest$TestExecutor.lambda$execute$0(CancelRequestTest.java:143)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
... 1 more
Caused by: java.security.cert.CertificateException: No subject alternative DNS name matching somehostname found.
at java.base/sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:207)
at java.base/sun.security.util.HostnameChecker.match(HostnameChecker.java:103)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:457)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:417)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:291)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:144)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1296)
... 22 more
The test passed on JDK 20 and failed on JDK21.
The test passed if the repo updated to the commits before https://github.com/openjdk/jdk/commit/90b4006bce6a4c28f93297da06be3b30d02fa89f
But not sure that the commit is directly related to the exception. It could be the certs used by the test.
The list of affected tests:
java/net/httpclient/CancelRequestTest.java
java/net/httpclient/CookieHeaderTest.java
java/net/httpclient/HttpClientClose.java
java/net/httpclient/HttpClientShutdown.java
java/net/httpclient/HttpRedirectTest.java
java/net/httpclient/InvalidInputStreamSubscriptionRequest.java
java/net/httpclient/InvalidSubscriptionRequest.java
java/net/httpclient/RetryWithCookie.java
java/net/httpclient/ThrowingSubscribersAsInputStream.java
java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java
java/net/httpclient/ThrowingSubscribersAsLines.java
java/net/httpclient/ThrowingSubscribersAsLinesAsync.java
java/net/httpclient/ThrowingSubscribersAsString.java
java/net/httpclient/ThrowingSubscribersAsStringAsync.java
java/net/httpclient/UserCookieTest.java