JDK-8198928 : (so) SocketChannel connect may deadlock if closed at around same time that connect fails
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 11
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2018-03-02
  • Updated: 2018-06-10
  • Resolved: 2018-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b04Fixed
Related Reports
Relates :  
Relates :  
Description
The test java/net/httpclient/TimeoutBasic.java  timeout on Linux x64

result: Error. Program `jdk-11/bin/java' timed out (timeout set to 1200000ms, elapsed time including timeout handling was 1228004ms).

Please see the jstack output. There is an deadlock identified:
Full thread dump Java HotSpot(TM) 64-Bit Server VM (11-internal+0-jdk11-jdk.112 mixed mode):

Threads class SMR info:
_java_thread_list=0x00007f9628000cd0, length=15, elements={
0x00007f9714013800, 0x00007f9714263000, 0x00007f9714265000, 0x00007f971427c800,
0x00007f971427e800, 0x00007f9714281000, 0x00007f9714283000, 0x00007f9714285000,
0x00007f9714287000, 0x00007f9714344000, 0x00007f9714378800, 0x00007f9714558800,
0x00007f966c0d8000, 0x00007f9660008000, 0x00007f9698001000
}

"main" #1 prio=5 os_prio=0 tid=0x00007f9714013800 nid=0x315 in Object.wait()  [0x00007f971c52d000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@11-internal/Native Method)
	- waiting on <0x00000000e00e56f0> (a java.lang.Thread)
	at java.lang.Thread.join(java.base@11-internal/Thread.java:1355)
	- waiting to re-lock in wait() <0x00000000e00e56f0> (a java.lang.Thread)
	at java.lang.Thread.join(java.base@11-internal/Thread.java:1429)
	at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:74)

"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007f9714263000 nid=0x32f waiting on condition  [0x00007f96f869e000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.ref.Reference.waitForReferencePendingList(java.base@11-internal/Native Method)
	at java.lang.ref.Reference.processPendingReferences(java.base@11-internal/Reference.java:166)
	at java.lang.ref.Reference.access$000(java.base@11-internal/Reference.java:44)
	at java.lang.ref.Reference$ReferenceHandler.run(java.base@11-internal/Reference.java:138)

"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x00007f9714265000 nid=0x330 in Object.wait()  [0x00007f96f859d000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(java.base@11-internal/Native Method)
	- waiting on <0x00000000e00f80f0> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@11-internal/ReferenceQueue.java:151)
	- waiting to re-lock in wait() <0x00000000e00f80f0> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@11-internal/ReferenceQueue.java:172)
	at java.lang.ref.Finalizer$FinalizerThread.run(java.base@11-internal/Finalizer.java:170)

"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x00007f971427c800 nid=0x331 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007f971427e800 nid=0x332 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"C2 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007f9714281000 nid=0x333 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"C2 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x00007f9714283000 nid=0x334 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"C1 CompilerThread3" #8 daemon prio=9 os_prio=0 tid=0x00007f9714285000 nid=0x335 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"Sweeper thread" #9 daemon prio=9 os_prio=0 tid=0x00007f9714287000 nid=0x336 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Service Thread" #10 daemon prio=9 os_prio=0 tid=0x00007f9714344000 nid=0x337 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Common-Cleaner" #11 daemon prio=8 os_prio=0 tid=0x00007f9714378800 nid=0x338 in Object.wait()  [0x00007f96c94fb000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(java.base@11-internal/Native Method)
	- waiting on <0x00000000e0c0d9c8> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(java.base@11-internal/ReferenceQueue.java:151)
	- waiting to re-lock in wait() <0x00000000e0c0d9c8> (a java.lang.ref.ReferenceQueue$Lock)
	at jdk.internal.ref.CleanerImpl.run(java.base@11-internal/CleanerImpl.java:148)
	at java.lang.Thread.run(java.base@11-internal/Thread.java:842)
	at jdk.internal.misc.InnocuousThread.run(java.base@11-internal/InnocuousThread.java:134)

"MainThread" #13 prio=5 os_prio=0 tid=0x00007f9714558800 nid=0x33a waiting on condition  [0x00007f96c8ed0000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@11-internal/Native Method)
	- parking to wait for  <0x00000000e02221c8> (a java.util.concurrent.CompletableFuture$Signaller)
	at java.util.concurrent.locks.LockSupport.park(java.base@11-internal/LockSupport.java:194)
	at java.util.concurrent.CompletableFuture$Signaller.block(java.base@11-internal/CompletableFuture.java:1796)
	at java.util.concurrent.ForkJoinPool.managedBlock(java.base@11-internal/ForkJoinPool.java:3156)
	at java.util.concurrent.CompletableFuture.waitingGet(java.base@11-internal/CompletableFuture.java:1823)
	at java.util.concurrent.CompletableFuture.join(java.base@11-internal/CompletableFuture.java:2043)
	at TimeoutBasic.test(TimeoutBasic.java:155)
	at TimeoutBasic.main(TimeoutBasic.java:91)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@11-internal/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@11-internal/NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11-internal/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@11-internal/Method.java:564)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
	at java.lang.Thread.run(java.base@11-internal/Thread.java:842)

"HttpClient-6-SelectorManager" #35 daemon prio=5 os_prio=0 tid=0x00007f966c0d8000 nid=0x3d4 waiting on condition  [0x00007f96c8176000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@11-internal/Native Method)
	- parking to wait for  <0x00000000e0cbf6a0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(java.base@11-internal/LockSupport.java:194)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(java.base@11-internal/AbstractQueuedSynchronizer.java:885)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(java.base@11-internal/AbstractQueuedSynchronizer.java:917)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@11-internal/AbstractQueuedSynchronizer.java:1240)
	at java.util.concurrent.locks.ReentrantLock.lock(java.base@11-internal/ReentrantLock.java:267)
	at sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(java.base@11-internal/SocketChannelImpl.java:839)
	at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(java.base@11-internal/AbstractSelectableChannel.java:241)
	at java.nio.channels.spi.AbstractInterruptibleChannel.close(java.base@11-internal/AbstractInterruptibleChannel.java:112)
	- locked <0x00000000e0cbf660> (a java.lang.Object)
	at jdk.incubator.http.PlainHttpConnection.close(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:189)
	- locked <0x00000000e0cbf378> (a jdk.incubator.http.PlainHttpConnection)
	at jdk.incubator.http.Http1Exchange.cancelImpl(jdk.incubator.httpclient@11-internal/Http1Exchange.java:379)
	- locked <0x00000000e0cbf128> (a java.lang.Object)
	at jdk.incubator.http.Http1Exchange.cancel(jdk.incubator.httpclient@11-internal/Http1Exchange.java:366)
	at jdk.incubator.http.Exchange.cancel(jdk.incubator.httpclient@11-internal/Exchange.java:174)
	at jdk.incubator.http.MultiExchange.cancel(jdk.incubator.httpclient@11-internal/MultiExchange.java:212)
	at jdk.incubator.http.MultiExchange$TimedEvent.handle(jdk.incubator.httpclient@11-internal/MultiExchange.java:354)
	at jdk.incubator.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:1019)
	at jdk.incubator.http.HttpClientImpl.access$300(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:76)
	at jdk.incubator.http.HttpClientImpl$SelectorManager.run(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:698)

"HttpClient-6-Worker-2" #38 daemon prio=5 os_prio=0 tid=0x00007f9660008000 nid=0x3d8 waiting for monitor entry  [0x00007f965aceb000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.nio.channels.spi.AbstractInterruptibleChannel.close(java.base@11-internal/AbstractInterruptibleChannel.java:109)
	- waiting to lock <0x00000000e0cbf660> (a java.lang.Object)
	at sun.nio.ch.SocketChannelImpl.connect(java.base@11-internal/SocketChannelImpl.java:663)
	at jdk.incubator.http.PlainHttpConnection.lambda$connectAsync$0(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:110)
	at jdk.incubator.http.PlainHttpConnection$$Lambda$62/0x000000010014dc30.run(jdk.incubator.httpclient@11-internal/Unknown Source)
	at java.security.AccessController.doPrivileged(java.base@11-internal/Native Method)
	at jdk.incubator.http.PlainHttpConnection.connectAsync(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:112)
	at jdk.incubator.http.Http1Exchange.sendHeadersAsync(jdk.incubator.httpclient@11-internal/Http1Exchange.java:234)
	at jdk.incubator.http.Exchange.lambda$responseAsyncImpl0$8(jdk.incubator.httpclient@11-internal/Exchange.java:322)
	at jdk.incubator.http.Exchange$$Lambda$75/0x0000000100151830.apply(jdk.incubator.httpclient@11-internal/Unknown Source)
	at java.util.concurrent.CompletableFuture.uniComposeStage(java.base@11-internal/CompletableFuture.java:1106)
	at java.util.concurrent.CompletableFuture.thenCompose(java.base@11-internal/CompletableFuture.java:2235)
	at jdk.incubator.http.Exchange.responseAsyncImpl0(jdk.incubator.httpclient@11-internal/Exchange.java:322)
	at jdk.incubator.http.Exchange.responseAsyncImpl(jdk.incubator.httpclient@11-internal/Exchange.java:286)
	at jdk.incubator.http.Exchange.responseAsync(jdk.incubator.httpclient@11-internal/Exchange.java:278)
	at jdk.incubator.http.MultiExchange.responseAsyncImpl(jdk.incubator.httpclient@11-internal/MultiExchange.java:268)
	at jdk.incubator.http.MultiExchange.lambda$responseAsync0$1(jdk.incubator.httpclient@11-internal/MultiExchange.java:224)
	at jdk.incubator.http.MultiExchange$$Lambda$46/0x0000000100123c30.apply(jdk.incubator.httpclient@11-internal/Unknown Source)
	at java.util.concurrent.CompletableFuture$UniCompose.tryFire(java.base@11-internal/CompletableFuture.java:1072)
	at java.util.concurrent.CompletableFuture.postComplete(java.base@11-internal/CompletableFuture.java:506)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(java.base@11-internal/CompletableFuture.java:1705)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11-internal/ThreadPoolExecutor.java:1128)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11-internal/ThreadPoolExecutor.java:628)
	at java.lang.Thread.run(java.base@11-internal/Thread.java:842)

"Attach Listener" #39 daemon prio=9 os_prio=0 tid=0x00007f9698001000 nid=0x5283 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"VM Thread" os_prio=0 tid=0x00007f9714259000 nid=0x32e runnable  

"GC Thread#0" os_prio=0 tid=0x00007f9714029800 nid=0x316 runnable  

"GC Thread#1" os_prio=0 tid=0x00007f971402b000 nid=0x317 runnable  

"GC Thread#2" os_prio=0 tid=0x00007f971402d000 nid=0x318 runnable  

"GC Thread#3" os_prio=0 tid=0x00007f971402e800 nid=0x319 runnable  

"GC Thread#4" os_prio=0 tid=0x00007f9714030800 nid=0x31b runnable  

"GC Thread#5" os_prio=0 tid=0x00007f9714032800 nid=0x31c runnable  

"GC Thread#6" os_prio=0 tid=0x00007f9714034000 nid=0x31d runnable  

"GC Thread#7" os_prio=0 tid=0x00007f9714036000 nid=0x31e runnable  

"G1 Main Marker" os_prio=0 tid=0x00007f9714056000 nid=0x31f runnable  

"G1 Conc#0" os_prio=0 tid=0x00007f9714058000 nid=0x320 runnable  

"G1 Conc#1" os_prio=0 tid=0x00007f9714059800 nid=0x323 runnable  

"G1 Refine#0" os_prio=0 tid=0x00007f97141ea800 nid=0x324 runnable  

"G1 Refine#1" os_prio=0 tid=0x00007f97141ec800 nid=0x325 runnable  

"G1 Refine#2" os_prio=0 tid=0x00007f97141ee000 nid=0x326 runnable  

"G1 Refine#3" os_prio=0 tid=0x00007f97141f0000 nid=0x327 runnable  

"G1 Refine#4" os_prio=0 tid=0x00007f97141f2000 nid=0x328 runnable  

"G1 Refine#5" os_prio=0 tid=0x00007f97141f3800 nid=0x329 runnable  

"G1 Refine#6" os_prio=0 tid=0x00007f97141f5800 nid=0x32a runnable  

"G1 Refine#7" os_prio=0 tid=0x00007f97141f7800 nid=0x32b runnable  

"G1 Young RemSet Sampling" os_prio=0 tid=0x00007f97141f9000 nid=0x32c runnable  
"VM Periodic Task Thread" os_prio=0 tid=0x00007f971437a800 nid=0x339 waiting on condition  

JNI global refs: 15, weak refs: 0


Found one Java-level deadlock:
=============================
"HttpClient-6-SelectorManager":
  waiting for ownable synchronizer 0x00000000e0cbf6a0, (a java.util.concurrent.locks.ReentrantLock$NonfairSync),
  which is held by "HttpClient-6-Worker-2"
"HttpClient-6-Worker-2":
  waiting to lock monitor 0x00007f96a0008b00 (object 0x00000000e0cbf660, a java.lang.Object),
  which is held by "HttpClient-6-SelectorManager"

Java stack information for the threads listed above:
===================================================
"HttpClient-6-SelectorManager":
	at jdk.internal.misc.Unsafe.park(java.base@11-internal/Native Method)
	- parking to wait for  <0x00000000e0cbf6a0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(java.base@11-internal/LockSupport.java:194)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(java.base@11-internal/AbstractQueuedSynchronizer.java:885)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(java.base@11-internal/AbstractQueuedSynchronizer.java:917)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@11-internal/AbstractQueuedSynchronizer.java:1240)
	at java.util.concurrent.locks.ReentrantLock.lock(java.base@11-internal/ReentrantLock.java:267)
	at sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(java.base@11-internal/SocketChannelImpl.java:839)
	at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(java.base@11-internal/AbstractSelectableChannel.java:241)
	at java.nio.channels.spi.AbstractInterruptibleChannel.close(java.base@11-internal/AbstractInterruptibleChannel.java:112)
	- locked <0x00000000e0cbf660> (a java.lang.Object)
	at jdk.incubator.http.PlainHttpConnection.close(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:189)
	- locked <0x00000000e0cbf378> (a jdk.incubator.http.PlainHttpConnection)
	at jdk.incubator.http.Http1Exchange.cancelImpl(jdk.incubator.httpclient@11-internal/Http1Exchange.java:379)
	- locked <0x00000000e0cbf128> (a java.lang.Object)
	at jdk.incubator.http.Http1Exchange.cancel(jdk.incubator.httpclient@11-internal/Http1Exchange.java:366)
	at jdk.incubator.http.Exchange.cancel(jdk.incubator.httpclient@11-internal/Exchange.java:174)
	at jdk.incubator.http.MultiExchange.cancel(jdk.incubator.httpclient@11-internal/MultiExchange.java:212)
	at jdk.incubator.http.MultiExchange$TimedEvent.handle(jdk.incubator.httpclient@11-internal/MultiExchange.java:354)
	at jdk.incubator.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:1019)
	at jdk.incubator.http.HttpClientImpl.access$300(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:76)
	at jdk.incubator.http.HttpClientImpl$SelectorManager.run(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:698)
"HttpClient-6-Worker-2":
	at java.nio.channels.spi.AbstractInterruptibleChannel.close(java.base@11-internal/AbstractInterruptibleChannel.java:109)
	- waiting to lock <0x00000000e0cbf660> (a java.lang.Object)
	at sun.nio.ch.SocketChannelImpl.connect(java.base@11-internal/SocketChannelImpl.java:663)
	at jdk.incubator.http.PlainHttpConnection.lambda$connectAsync$0(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:110)
	at jdk.incubator.http.PlainHttpConnection$$Lambda$62/0x000000010014dc30.run(jdk.incubator.httpclient@11-internal/Unknown Source)
	at java.security.AccessController.doPrivileged(java.base@11-internal/Native Method)
	at jdk.incubator.http.PlainHttpConnection.connectAsync(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:112)
	at jdk.incubator.http.Http1Exchange.sendHeadersAsync(jdk.incubator.httpclient@11-internal/Http1Exchange.java:234)
	at jdk.incubator.http.Exchange.lambda$responseAsyncImpl0$8(jdk.incubator.httpclient@11-internal/Exchange.java:322)
	at jdk.incubator.http.Exchange$$Lambda$75/0x0000000100151830.apply(jdk.incubator.httpclient@11-internal/Unknown Source)
	at java.util.concurrent.CompletableFuture.uniComposeStage(java.base@11-internal/CompletableFuture.java:1106)
	at java.util.concurrent.CompletableFuture.thenCompose(java.base@11-internal/CompletableFuture.java:2235)
	at jdk.incubator.http.Exchange.responseAsyncImpl0(jdk.incubator.httpclient@11-internal/Exchange.java:322)
	at jdk.incubator.http.Exchange.responseAsyncImpl(jdk.incubator.httpclient@11-internal/Exchange.java:286)
	at jdk.incubator.http.Exchange.responseAsync(jdk.incubator.httpclient@11-internal/Exchange.java:278)
	at jdk.incubator.http.MultiExchange.responseAsyncImpl(jdk.incubator.httpclient@11-internal/MultiExchange.java:268)
	at jdk.incubator.http.MultiExchange.lambda$responseAsync0$1(jdk.incubator.httpclient@11-internal/MultiExchange.java:224)
	at jdk.incubator.http.MultiExchange$$Lambda$46/0x0000000100123c30.apply(jdk.incubator.httpclient@11-internal/Unknown Source)
	at java.util.concurrent.CompletableFuture$UniCompose.tryFire(java.base@11-internal/CompletableFuture.java:1072)
	at java.util.concurrent.CompletableFuture.postComplete(java.base@11-internal/CompletableFuture.java:506)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(java.base@11-internal/CompletableFuture.java:1705)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11-internal/ThreadPoolExecutor.java:1128)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11-internal/ThreadPoolExecutor.java:628)
	at java.lang.Thread.run(java.base@11-internal/Thread.java:842)

Found 1 deadlock.


Comments
It looks to be possibly a regression introduced by JDK-8198562, JDK-8198754. At 663 line of SocketChannelImpl, one thread is attempting to close (wants closeLock) but still occupying readlLock and writeLock. While closeLock is obtained by other thread, and wants readLock in SocketChannelImpl.implCloseSelectableChannel().
10-06-2018

This is indeed caused by recent changes JDK-8198562. The old implementation got away with closing the channel when connect or finishConnect failed because the close implementation wasn't correctly synchronized with concurrent I/O operations. Note that I ran these tests through Mach5 many times and did not see this issue before pushing the change.
02-03-2018

Observed again. 2018-03-01 23:16:03 Full thread dump Java HotSpot(TM) 64-Bit Server VM (11-internal+0-jdk11-jdk.115 mixed mode): Threads class SMR info: _java_thread_list=0x00007fb9f4002c10, length=15, elements={ 0x00007fba9c013800, 0x00007fba9c263000, 0x00007fba9c265000, 0x00007fba9c27c800, 0x00007fba9c27e800, 0x00007fba9c281000, 0x00007fba9c283000, 0x00007fba9c285000, 0x00007fba9c287000, 0x00007fba9c354000, 0x00007fba9c360800, 0x00007fba9c550800, 0x00007fb9f0139800, 0x00007fb9e4001000, 0x00007fba18001000 } &quotmain&quot #1 prio=5 os_prio=0 tid=0x00007fba9c013800 nid=0x408d in Object.wait() [0x00007fbaa2b70000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@11-internal/Native Method) - waiting on &lt;0x00000000e00c8b48&gt; (a java.lang.Thread) at java.lang.Thread.join(java.base@11-internal/Thread.java:1355) - waiting to re-lock in wait() &lt;0x00000000e00c8b48&gt; (a java.lang.Thread) at java.lang.Thread.join(java.base@11-internal/Thread.java:1429) at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:74) &quotReference Handler&quot #2 daemon prio=10 os_prio=0 tid=0x00007fba9c263000 nid=0x40a3 waiting on condition [0x00007fba58475000] java.lang.Thread.State: RUNNABLE at java.lang.ref.Reference.waitForReferencePendingList(java.base@11-internal/Native Method) at java.lang.ref.Reference.processPendingReferences(java.base@11-internal/Reference.java:166) at java.lang.ref.Reference.access$000(java.base@11-internal/Reference.java:44) at java.lang.ref.Reference$ReferenceHandler.run(java.base@11-internal/Reference.java:138) &quotFinalizer&quot #3 daemon prio=8 os_prio=0 tid=0x00007fba9c265000 nid=0x40a4 in Object.wait() [0x00007fba58374000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@11-internal/Native Method) - waiting on &lt;0x00000000e02cc4b8&gt; (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11-internal/ReferenceQueue.java:151) - waiting to re-lock in wait() &lt;0x00000000e02cc4b8&gt; (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11-internal/ReferenceQueue.java:172) at java.lang.ref.Finalizer$FinalizerThread.run(java.base@11-internal/Finalizer.java:170) &quotSignal Dispatcher&quot #4 daemon prio=9 os_prio=0 tid=0x00007fba9c27c800 nid=0x40a5 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE &quotC2 CompilerThread0&quot #5 daemon prio=9 os_prio=0 tid=0x00007fba9c27e800 nid=0x40a6 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE No compile task &quotC2 CompilerThread1&quot #6 daemon prio=9 os_prio=0 tid=0x00007fba9c281000 nid=0x40a7 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE No compile task &quotC2 CompilerThread2&quot #7 daemon prio=9 os_prio=0 tid=0x00007fba9c283000 nid=0x40a8 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE No compile task &quotC1 CompilerThread3&quot #8 daemon prio=9 os_prio=0 tid=0x00007fba9c285000 nid=0x40a9 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE No compile task &quotSweeper thread&quot #9 daemon prio=9 os_prio=0 tid=0x00007fba9c287000 nid=0x40aa runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE &quotService Thread&quot #10 daemon prio=9 os_prio=0 tid=0x00007fba9c354000 nid=0x40ad runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE &quotCommon-Cleaner&quot #11 daemon prio=8 os_prio=0 tid=0x00007fba9c360800 nid=0x40ae in Object.wait() [0x00007fba17af9000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(java.base@11-internal/Native Method) - waiting on &lt;0x00000000e0137af0&gt; (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11-internal/ReferenceQueue.java:151) - waiting to re-lock in wait() &lt;0x00000000e0137af0&gt; (a java.lang.ref.ReferenceQueue$Lock) at jdk.internal.ref.CleanerImpl.run(java.base@11-internal/CleanerImpl.java:148) at java.lang.Thread.run(java.base@11-internal/Thread.java:842) at jdk.internal.misc.InnocuousThread.run(java.base@11-internal/InnocuousThread.java:134) &quotMainThread&quot #13 prio=5 os_prio=0 tid=0x00007fba9c550800 nid=0x40b0 waiting on condition [0x00007fba174ce000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11-internal/Native Method) - parking to wait for &lt;0x00000000e0072f40&gt; (a java.util.concurrent.CompletableFuture$Signaller) at java.util.concurrent.locks.LockSupport.park(java.base@11-internal/LockSupport.java:194) at java.util.concurrent.CompletableFuture$Signaller.block(java.base@11-internal/CompletableFuture.java:1796) at java.util.concurrent.ForkJoinPool.managedBlock(java.base@11-internal/ForkJoinPool.java:3156) at java.util.concurrent.CompletableFuture.waitingGet(java.base@11-internal/CompletableFuture.java:1823) at java.util.concurrent.CompletableFuture.join(java.base@11-internal/CompletableFuture.java:2043) at TimeoutBasic.test(TimeoutBasic.java:155) at TimeoutBasic.main(TimeoutBasic.java:91) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@11-internal/Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@11-internal/NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11-internal/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@11-internal/Method.java:564) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115) at java.lang.Thread.run(java.base@11-internal/Thread.java:842) &quotHttpClient-2-SelectorManager&quot #18 daemon prio=5 os_prio=0 tid=0x00007fb9f0139800 nid=0x40bd waiting on condition [0x00007fba166c2000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11-internal/Native Method) - parking to wait for &lt;0x00000000e01a60d8&gt; (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(java.base@11-internal/LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(java.base@11-internal/AbstractQueuedSynchronizer.java:885) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(java.base@11-internal/AbstractQueuedSynchronizer.java:917) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@11-internal/AbstractQueuedSynchronizer.java:1240) at java.util.concurrent.locks.ReentrantLock.lock(java.base@11-internal/ReentrantLock.java:267) at sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(java.base@11-internal/SocketChannelImpl.java:839) at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(java.base@11-internal/AbstractSelectableChannel.java:241) at java.nio.channels.spi.AbstractInterruptibleChannel.close(java.base@11-internal/AbstractInterruptibleChannel.java:112) - locked &lt;0x00000000e01a6098&gt; (a java.lang.Object) at jdk.incubator.http.PlainHttpConnection.close(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:189) - locked &lt;0x00000000e01a5db0&gt; (a jdk.incubator.http.PlainHttpConnection) at jdk.incubator.http.Http1Exchange.cancelImpl(jdk.incubator.httpclient@11-internal/Http1Exchange.java:379) - locked &lt;0x00000000e01a5b60&gt; (a java.lang.Object) at jdk.incubator.http.Http1Exchange.cancel(jdk.incubator.httpclient@11-internal/Http1Exchange.java:366) at jdk.incubator.http.Exchange.cancel(jdk.incubator.httpclient@11-internal/Exchange.java:174) at jdk.incubator.http.MultiExchange.cancel(jdk.incubator.httpclient@11-internal/MultiExchange.java:212) at jdk.incubator.http.MultiExchange$TimedEvent.handle(jdk.incubator.httpclient@11-internal/MultiExchange.java:354) at jdk.incubator.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:1019) at jdk.incubator.http.HttpClientImpl.access$300(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:76) at jdk.incubator.http.HttpClientImpl$SelectorManager.run(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:662) &quotHttpClient-2-Worker-1&quot #20 daemon prio=5 os_prio=0 tid=0x00007fb9e4001000 nid=0x40bf waiting for monitor entry [0x00007fba162be000] java.lang.Thread.State: BLOCKED (on object monitor) at java.nio.channels.spi.AbstractInterruptibleChannel.close(java.base@11-internal/AbstractInterruptibleChannel.java:109) - waiting to lock &lt;0x00000000e01a6098&gt; (a java.lang.Object) at sun.nio.ch.SocketChannelImpl.connect(java.base@11-internal/SocketChannelImpl.java:663) at jdk.incubator.http.PlainHttpConnection.lambda$connectAsync$0(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:110) at jdk.incubator.http.PlainHttpConnection$$Lambda$62/0x000000010014dc30.run(jdk.incubator.httpclient@11-internal/Unknown Source) at java.security.AccessController.doPrivileged(java.base@11-internal/Native Method) at jdk.incubator.http.PlainHttpConnection.connectAsync(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:112) at jdk.incubator.http.Http1Exchange.sendHeadersAsync(jdk.incubator.httpclient@11-internal/Http1Exchange.java:234) at jdk.incubator.http.Exchange.lambda$responseAsyncImpl0$8(jdk.incubator.httpclient@11-internal/Exchange.java:322) at jdk.incubator.http.Exchange$$Lambda$97/0x000000010015fc30.apply(jdk.incubator.httpclient@11-internal/Unknown Source) at java.util.concurrent.CompletableFuture.uniComposeStage(java.base@11-internal/CompletableFuture.java:1106) at java.util.concurrent.CompletableFuture.thenCompose(java.base@11-internal/CompletableFuture.java:2235) at jdk.incubator.http.Exchange.responseAsyncImpl0(jdk.incubator.httpclient@11-internal/Exchange.java:322) at jdk.incubator.http.Exchange.responseAsyncImpl(jdk.incubator.httpclient@11-internal/Exchange.java:286) at jdk.incubator.http.Exchange.responseAsync(jdk.incubator.httpclient@11-internal/Exchange.java:278) at jdk.incubator.http.MultiExchange.responseAsyncImpl(jdk.incubator.httpclient@11-internal/MultiExchange.java:268) at jdk.incubator.http.MultiExchange.lambda$responseAsync0$1(jdk.incubator.httpclient@11-internal/MultiExchange.java:224) at jdk.incubator.http.MultiExchange$$Lambda$46/0x0000000100123c30.apply(jdk.incubator.httpclient@11-internal/Unknown Source) at java.util.concurrent.CompletableFuture$UniCompose.tryFire(java.base@11-internal/CompletableFuture.java:1072) at java.util.concurrent.CompletableFuture.postComplete(java.base@11-internal/CompletableFuture.java:506) at java.util.concurrent.CompletableFuture$AsyncSupply.run(java.base@11-internal/CompletableFuture.java:1705) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11-internal/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11-internal/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11-internal/Thread.java:842) &quotAttach Listener&quot #23 daemon prio=9 os_prio=0 tid=0x00007fba18001000 nid=0x261d waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE &quotVM Thread&quot os_prio=0 tid=0x00007fba9c259000 nid=0x40a2 runnable &quotGC Thread#0&quot os_prio=0 tid=0x00007fba9c029800 nid=0x408e runnable &quotGC Thread#1&quot os_prio=0 tid=0x00007fba9c02b000 nid=0x408f runnable &quotGC Thread#2&quot os_prio=0 tid=0x00007fba9c02d000 nid=0x4090 runnable &quotGC Thread#3&quot os_prio=0 tid=0x00007fba9c02e800 nid=0x4091 runnable &quotGC Thread#4&quot os_prio=0 tid=0x00007fba9c030800 nid=0x4092 runnable &quotGC Thread#5&quot os_prio=0 tid=0x00007fba9c032800 nid=0x4093 runnable &quotGC Thread#6&quot os_prio=0 tid=0x00007fba9c034000 nid=0x4094 runnable &quotGC Thread#7&quot os_prio=0 tid=0x00007fba9c036000 nid=0x4095 runnable &quotG1 Main Marker&quot os_prio=0 tid=0x00007fba9c056000 nid=0x4096 runnable &quotG1 Conc#0&quot os_prio=0 tid=0x00007fba9c058000 nid=0x4097 runnable &quotG1 Conc#1&quot os_prio=0 tid=0x00007fba9c059800 nid=0x4098 runnable &quotG1 Refine#0&quot os_prio=0 tid=0x00007fba9c1ea800 nid=0x4099 runnable &quotG1 Refine#1&quot os_prio=0 tid=0x00007fba9c1ec800 nid=0x409a runnable &quotG1 Refine#2&quot os_prio=0 tid=0x00007fba9c1ee000 nid=0x409b runnable &quotG1 Refine#3&quot os_prio=0 tid=0x00007fba9c1f0000 nid=0x409c runnable &quotG1 Refine#4&quot os_prio=0 tid=0x00007fba9c1f2000 nid=0x409d runnable &quotG1 Refine#5&quot os_prio=0 tid=0x00007fba9c1f3800 nid=0x409e runnable &quotG1 Refine#6&quot os_prio=0 tid=0x00007fba9c1f5800 nid=0x409f runnable &quotG1 Refine#7&quot os_prio=0 tid=0x00007fba9c1f7800 nid=0x40a0 runnable &quotG1 Young RemSet Sampling&quot os_prio=0 tid=0x00007fba9c1f9000 nid=0x40a1 runnable &quotVM Periodic Task Thread&quot os_prio=0 tid=0x00007fba9c362800 nid=0x40af waiting on condition JNI global refs: 15, weak refs: 0 Found one Java-level deadlock: ============================= &quotHttpClient-2-SelectorManager&quot: waiting for ownable synchronizer 0x00000000e01a60d8, (a java.util.concurrent.locks.ReentrantLock$NonfairSync), which is held by &quotHttpClient-2-Worker-1&quot &quotHttpClient-2-Worker-1&quot: waiting to lock monitor 0x00007fba20008b00 (object 0x00000000e01a6098, a java.lang.Object), which is held by &quotHttpClient-2-SelectorManager&quot Java stack information for the threads listed above: =================================================== &quotHttpClient-2-SelectorManager&quot: at jdk.internal.misc.Unsafe.park(java.base@11-internal/Native Method) - parking to wait for &lt;0x00000000e01a60d8&gt; (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(java.base@11-internal/LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(java.base@11-internal/AbstractQueuedSynchronizer.java:885) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(java.base@11-internal/AbstractQueuedSynchronizer.java:917) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(java.base@11-internal/AbstractQueuedSynchronizer.java:1240) at java.util.concurrent.locks.ReentrantLock.lock(java.base@11-internal/ReentrantLock.java:267) at sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(java.base@11-internal/SocketChannelImpl.java:839) at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(java.base@11-internal/AbstractSelectableChannel.java:241) at java.nio.channels.spi.AbstractInterruptibleChannel.close(java.base@11-internal/AbstractInterruptibleChannel.java:112) - locked &lt;0x00000000e01a6098&gt; (a java.lang.Object) at jdk.incubator.http.PlainHttpConnection.close(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:189) - locked &lt;0x00000000e01a5db0&gt; (a jdk.incubator.http.PlainHttpConnection) at jdk.incubator.http.Http1Exchange.cancelImpl(jdk.incubator.httpclient@11-internal/Http1Exchange.java:379) - locked &lt;0x00000000e01a5b60&gt; (a java.lang.Object) at jdk.incubator.http.Http1Exchange.cancel(jdk.incubator.httpclient@11-internal/Http1Exchange.java:366) at jdk.incubator.http.Exchange.cancel(jdk.incubator.httpclient@11-internal/Exchange.java:174) at jdk.incubator.http.MultiExchange.cancel(jdk.incubator.httpclient@11-internal/MultiExchange.java:212) at jdk.incubator.http.MultiExchange$TimedEvent.handle(jdk.incubator.httpclient@11-internal/MultiExchange.java:354) at jdk.incubator.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:1019) at jdk.incubator.http.HttpClientImpl.access$300(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:76) at jdk.incubator.http.HttpClientImpl$SelectorManager.run(jdk.incubator.httpclient@11-internal/HttpClientImpl.java:662) &quotHttpClient-2-Worker-1&quot: at java.nio.channels.spi.AbstractInterruptibleChannel.close(java.base@11-internal/AbstractInterruptibleChannel.java:109) - waiting to lock &lt;0x00000000e01a6098&gt; (a java.lang.Object) at sun.nio.ch.SocketChannelImpl.connect(java.base@11-internal/SocketChannelImpl.java:663) at jdk.incubator.http.PlainHttpConnection.lambda$connectAsync$0(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:110) at jdk.incubator.http.PlainHttpConnection$$Lambda$62/0x000000010014dc30.run(jdk.incubator.httpclient@11-internal/Unknown Source) at java.security.AccessController.doPrivileged(java.base@11-internal/Native Method) at jdk.incubator.http.PlainHttpConnection.connectAsync(jdk.incubator.httpclient@11-internal/PlainHttpConnection.java:112) at jdk.incubator.http.Http1Exchange.sendHeadersAsync(jdk.incubator.httpclient@11-internal/Http1Exchange.java:234) at jdk.incubator.http.Exchange.lambda$responseAsyncImpl0$8(jdk.incubator.httpclient@11-internal/Exchange.java:322) at jdk.incubator.http.Exchange$$Lambda$97/0x000000010015fc30.apply(jdk.incubator.httpclient@11-internal/Unknown Source) at java.util.concurrent.CompletableFuture.uniComposeStage(java.base@11-internal/CompletableFuture.java:1106) at java.util.concurrent.CompletableFuture.thenCompose(java.base@11-internal/CompletableFuture.java:2235) at jdk.incubator.http.Exchange.responseAsyncImpl0(jdk.incubator.httpclient@11-internal/Exchange.java:322) at jdk.incubator.http.Exchange.responseAsyncImpl(jdk.incubator.httpclient@11-internal/Exchange.java:286) at jdk.incubator.http.Exchange.responseAsync(jdk.incubator.httpclient@11-internal/Exchange.java:278) at jdk.incubator.http.MultiExchange.responseAsyncImpl(jdk.incubator.httpclient@11-internal/MultiExchange.java:268) at jdk.incubator.http.MultiExchange.lambda$responseAsync0$1(jdk.incubator.httpclient@11-internal/MultiExchange.java:224) at jdk.incubator.http.MultiExchange$$Lambda$46/0x0000000100123c30.apply(jdk.incubator.httpclient@11-internal/Unknown Source) at java.util.concurrent.CompletableFuture$UniCompose.tryFire(java.base@11-internal/CompletableFuture.java:1072) at java.util.concurrent.CompletableFuture.postComplete(java.base@11-internal/CompletableFuture.java:506) at java.util.concurrent.CompletableFuture$AsyncSupply.run(java.base@11-internal/CompletableFuture.java:1705) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11-internal/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11-internal/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11-internal/Thread.java:842) Found 1 deadlock.
02-03-2018