question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The source channel is not cancelled when cancelling the result of `produce(onCompletion = consumes())`

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
qwwdfsadcommented, Jul 2, 2018

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

0reactions
qwwdfsadcommented, Jul 2, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found