oxidecomputer / oxidecomputer/omicron
Audit cases of "tokio::mpsc::channel, size of 1"
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
For background, see: https://github.com/oxidecomputer/omicron/issues/9259
Any case where we create a tokio::mpsc::channel of size 1, we are subsequently vulnerable to deadlock with the following code:
loop {
tokio::select! {
// Suppose this is queued first, but is only returning `Poll::pending`
_ = rx.send(...) => { return }
// Suppose instead, this select! branch triggers...
_ = yield_interval.tick() => {
// ... Then this call to `send` will be stuck forever, queued behind the first rx.send,
// which is no longer polled.
let result = rx.send(...).await;
if result = ... { return }
}
}
}
This issue will document cases where we're using mpscs, and risking this behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by searching the repository for tokio::mpsc::channel calls configured with a size of 1. Review each matching case for the described select! and send behavior, then document the affected cases and any resulting deadlock risk. The issue does not name specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100