-
Notifications
You must be signed in to change notification settings - Fork 30
Possible deadlock footgun with lost consumer #55
Comments
This aspect of the new design is unfortunate, but intentional. It was a really difficult decision to make. See #39 for the discussion and rationale. The good news is that it's still possible to simulate the old interface: |
Oh, I see there's some point in the unidirectionality and why bidirectional closing can be a footgun too. Anyway, two things:
|
Regarding deadlocks, are you suggesting to panic in situations like the following?
|
Yes, something like that… but being careful about it. I mean, trying to receive the second one on |
I noticed the
send
on the sender no longer returns a result. I find this a little bit troubling. Consider the producer-consumer design pattern. Originally, the producer would be doing something likesender.send(stuff).unwrap()
.Now, if the consumer terminated due to an error (for example by panicking), the panic would propagate, or would require the producer to handle it somehow. The application would probably terminate by an error. However, in the current implementation, the producer will deadlock (in case of bounded channel, in case of unbounded, it'll just keep eating memory forever), not bringing attention to the problem automatically by eg. crashing.
The previous version was a little bit more typing, but seemed to prevent these kinds of subtle bugs.
The text was updated successfully, but these errors were encountered: