WebAudio wasm build fails with wasm-bindgen panic=unwind closures
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust, wasm
- Domain
- audio-video-rtc
Research direction
Start with src/host/webaudio/mod.rs and inspect the Closure::wrap callback described in the issue. Check how wasm-bindgen 0.2.129 handles unwind safety for this callback, then build cpal for wasm32-unknown-unknown with panic=unwind to confirm the failure and verify the supported closure construction. Done when that build succeeds with the callback owned by the WebAudio host.
Written by the indexing model from the issue text.
Description
With Rust panic=unwind and current wasm-bindgen (0.2.129), cpal 0.18.2 fails to compile for wasm32-unknown-unknown in src/host/webaudio/mod.rs at Closure::wrap(Box::new(move || { ... })). The boxed callback type Box<dyn FnMut()> does not implement wasm-bindgen's MaybeUnwindSafe bound.
A local one-line fix is:
Closure::wrap_assert_unwind_safe(Box::new(move || { ... }))
The callback is owned by the WebAudio host and does not cross Rust threads. Would you consider this change, or another supported closure construction, in cpal?
- Dominant language
- Rust
- Stars
- 4k
- Forks
- 554
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 1
Getting set up
- Ships a 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/cpal
-
API design
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
correctness
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
aaudio: dynamic buffer tuning never grows the buffer (set_buffer_size_in_frames reports Err on success)Possibly taken @dannyward630 claimed this 39 days ago. Openhost - aaudio platform - android
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
-
PipeWire: dropping callback captures on the realtime worker can terminate the process with SIGXCPUOpenhost - pipewire platform - linux
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
WebAudio: after a main-thread stall, playback runs at 2x speed until the time cursor catches upOpenhost - webaudio platform - web
Difficulty 3/5 1-2 days Newbie friendliness 72/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