Skip to content

Inconsistent exceptional behaviour of channels closed with exception #2884

Open
@qwwdfsad

Description

@qwwdfsad

Steps to reproduce:

val channel = Channel<Int>()
launch {
    channel.send(1)
}
yield()
channel.close(RuntimeException("Failure"))
channel.cancel()

When the racing cancel comes to the channel that was correctly closed with an exception in order to propagate it to receivers, cancel has to wake up and cancel all the senders with an exception.

The problem is that cancel uses closing cause as an exception, triggering cascading failure on the sending side, even though the sending side correctly closed the channel and stopped all the consecutive sends.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions