The exception is revealed by running with -Djdk.httpclient.HttpClient.log=all
Nov 30, 2021 7:03:35 AM jdk.internal.net.http.HttpClientImpl$SelectorManager run
INFO: CHANNEL: HttpClient-1-SelectorManager: stopping
Nov 30, 2021 7:03:35 AM jdk.internal.net.http.HttpClientImpl$SelectorManager shutdown
INFO: MISC: HttpClient-1-SelectorManager: shutting down
Nov 30, 2021 7:03:35 AM jdk.internal.net.http.HttpClientImpl$SelectorManager run
INFO: ERROR: HttpClient-2-SelectorManager: HttpClientImpl shutting down due to fatal error: java.util.concurrent.RejectedExecutionException: java.lang.IllegalStateException: Current thread not owner or thread in flock
at java.base/java.util.concurrent.StructuredExecutor.execute(StructuredExecutor.java:465)
at java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(HttpClientImpl.java:153)
at java.net.http/jdk.internal.net.http.PlainHttpConnection$ConnectEvent.handle(PlainHttpConnection.java:152)
at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:977)
at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.lambda$run$3(HttpClientImpl.java:932)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:932)
Caused by: java.lang.IllegalStateException: Current thread not owner or thread in flock
at java.base/jdk.internal.misc.ThreadFlock.ensureOwnerOrContainsThread(ThreadFlock.java:204)
at java.base/jdk.internal.misc.ThreadFlock.start(ThreadFlock.java:267)
at java.base/java.util.concurrent.StructuredExecutor.spawn(StructuredExecutor.java:345)
at java.base/java.util.concurrent.StructuredExecutor.execute(StructuredExecutor.java:461)
... 6 more
This issue is created to examine this scenario, e.g.
- The REE is fatal so maybe the shutdown/exception should be printed to the console unconditionally, irrespective of whether logging is enabled or not.
- Maybe the spec for HttpClient.Builder.executor(Executor) should specify that the behavior is unspecified when an executor rejects tasks.
- Maybe there needs to be a fallback to at least complete exceptionally the CF that the client is waiting on, so they aren't hanging indefinitely.
- relates to
-
JDK-8297132 BACKOUT JDK-8296889: Race condition when cancelling a request
-
- Resolved
-
-
JDK-8297149 REDO JDK-8296889: Race condition when cancelling a request
-
- Resolved
-
-
JDK-8302635 Race condition in HttpBodySubscriberWrapper when cancelling request
-
- Closed
-
-
JDK-8294916 Cancelling a request must eventually cause its response body subscriber to be unregistered
-
- Closed
-
-
JDK-8296889 Race condition when cancelling a request
-
- Closed
-
-
JDK-8298340 java/net/httpclient/CancelRequestTest.java fails with AssertionError: Found some subscribers for testPostInterrupt
-
- Closed
-