Player::Append blocks thread in wasm
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust, wasm
- Domain
- audio-video-rtc
Research direction
The reporter traces the deadlock to Player::append, which calls sleep_until_end, which blocks on std::sync::mpsc::Receiver::recv. Start by reading that call path and confirming the blocking happens only on the wasm target, where audio runs on the calling thread instead of a separate one. Done means append no longer blocks the single wasm thread, and the clear-then-append sequence from the report completes in a wasm build.
Written by the indexing model from the issue text.
Description
I try to do simple thing:
- Call
Player::clear()to stop current audio track - Immediately after that I call
Player::append()to play new track
if !player.empty() {
player.clear();
}
player.append(sound);
It works fine on linux/windows, but it deadlocks my app thread in WASM.
I have a guess why: inside append there is call to sleep_until_end. sleep_until_end does std::sync::mpsc::Receiver::recv inside of it. And recv blocks calling thread. It causes no issues in linux/windows, because rodio lives in separate thread. But in wasm we have single thread for all things and recv blocks it.
(playing sound on empty Player in WASM works fine)
- Dominant language
- Rust
- Stars
- 2.5k
- Forks
- 338
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from RustAudio/rodio
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 1/5 Under an hour Newbie friendliness 73/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 67/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
ci: migrate pinned macos-15 runners to macos-26 and macos-26-intelPossibly taken @hawkingrei claimed this today. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
nowledge-co/hawdb#2224 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-score/coverage_tool#95 ·
Maintainers usually reply within 2 days
-
bug nvim
Difficulty 2/5 1-3 hours Newbie friendliness 74/100