Virtual threads and bug in CompletableFuture.get(timeout,unit)
Bela Ban
belaban at mailbox.org
Tue Jul 14 14:21:22 UTC 2020
I'm consistently running into the problem that a timed get(timeout,unit)
on CompletableFuture (see stack trace below) blocks for *up to timeout
millis* although complete(result) has been called.
If I use the non-timed CompletableFuture.get(), this always works: the
get() method returns as soon as complete() has been called.
I'm trying to put together a reproducer.
Are there any known issues with the timed in
CompletableFuture.get(timeout,unit) / VirtualThread.parkNanos() in Loom
(16-loom+2-14)?
Cheers,
Bela
-- VirtualThread[req-id=1122229,<no carrier thread>]:
java.base/java.lang.Continuation.yield0(Continuation.java:438)
java.base/java.lang.Continuation.yield(Continuation.java:430)
java.base/java.lang.VirtualThread.tryPark(VirtualThread.java:470)
java.base/java.lang.VirtualThread.parkNanos(VirtualThread.java:444)
java.base/java.lang.System$2.parkVirtualThread(System.java:2326)
java.base/jdk.internal.misc.VirtualThreads.park(VirtualThreads.java:63)
java.base/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:265)
java.base/java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1868)
java.base/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3139)
java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1938)
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2091)
org.jgroups.blocks.UnicastRequest.get(UnicastRequest.java:104)
org.jgroups.blocks.UnicastRequest.lambda$waitForCompletion$2(UnicastRequest.java:120)
org.jgroups.blocks.UnicastRequest.getResult(UnicastRequest.java:146)
org.jgroups.blocks.UnicastRequest.waitForCompletion(UnicastRequest.java:120)
org.jgroups.blocks.Request.execute(Request.java:52)
org.jgroups.blocks.MessageDispatcher.sendMessage(MessageDispatcher.java:334)
org.jgroups.blocks.RpcDispatcher.callRemoteMethod(RpcDispatcher.java:144)
org.jgroups.tests.perf.UPerf$Invoker.run(UPerf.java:519)
java.base/java.lang.VirtualThread.lambda$new$0(VirtualThread.java:133)
java.base/java.lang.Continuation.enter0(Continuation.java:394)
java.base/java.lang.Continuation.enter(Continuation.java:387)
--
Bela Ban | http://www.jgroups.org
More information about the loom-dev
mailing list