You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Test
fun testStackOverflow() = runTest {
val future = CompletableFuture<Int>()
val completed = AtomicLong()
val count = 10000L
for (i in 0 until count) {
launch(Dispatchers.Default) {
future.asDeferred().await()
completed.incrementAndGet()
}
}
future.complete(1)
withTimeout(60_000) {
coroutineContext.job.children.toList().joinAll()
assertEquals(count, completed.get())
}
}
The text was updated successfully, but these errors were encountered:
…ly report exceptions from completion handlers
* It turned out that 'cancel' on completed future tries to help and invoke 'whenComplete' handlers that also invoke 'cancel' on the very same future
* Use top-level exception handler as a last resort to deliver an exception
Fixes#2730
Kotlin#2731)
Prevent StackOverflowError in CompletableFuture.asDeferred and properly report exceptions from completion handlers
* It turned out that 'cancel' on completed future tries to help and invoke 'whenComplete' handlers that also invoke 'cancel' on the very same future
* Use top-level exception handler as a last resort to deliver an exception
FixesKotlin#2730
The text was updated successfully, but these errors were encountered: