The source channel is not cancelled when cancelling the result of `produce(onCompletion = consumes())`
See original GitHub issueThe following test hangs:
@Test
fun testCancelProduce() = runTest {
val source = Channel<Int>()
val produced = produce<Int>(Unconfined, onCompletion = source.consumes()) {
source.receive()
}
produced.cancel()
assertFails<Exception> { runTest { source.receive() } }
}
I would expect the test to pass.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Job - Kotlin
An exceptionally completed job is cancelled and the corresponding exception becomes the cancellation cause of the job. Normal cancellation of a job is ......
Read more >IO · Cats Effect - Typelevel
Returns a cancelable boundary — an IO task that checks for the cancellation status of the run-loop and does not allow for the...
Read more >Consumer Cancel Notification - RabbitMQ
Consumer Cancel Notification. Overview. When a channel is consuming from a queue, there are various reasons which could cause the consumption to stop....
Read more >Reactor 3 Reference Guide
For a Flux or Mono , cancellation is a signal that the source should stop producing elements. However, it is NOT guaranteed to...
Read more >chrome.webRequest - Chrome Developers
It does not allow you to modify or cancel the request. ... If modified headers for cross-origin requests do not meet the criteria,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your report. I’ve investigated your problem properly, It’s looks like a bug in coroutines+unconfined machinery (or at least it’s a poor-defined interaction between unconfined and other parts of coroutines). Will fix it in the next release
Thank you again for the report, your issue revealed even bigger problem which may cause unexpected non-determinism (and probably heisenbugs with “Exception in completion handler”) in programs without
Unconfined
.I described it under #415 and will fix it there