Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic in AudioBufferSourceNode #134

Closed
jipodine opened this issue Aug 26, 2024 · 8 comments
Closed

Panic in AudioBufferSourceNode #134

jipodine opened this issue Aug 26, 2024 · 8 comments

Comments

@jipodine
Copy link

jipodine commented Aug 26, 2024

While trying to play a looped bufferSourceNode, I got the following error:

Panic occurred in Audio Processor: 'index out of bounds: the len is 26332 but the index is 26368'. Removing node from graph.

And it failed to quit or crash the application

fatal runtime error: failed to initiate panic, error 1073786336

Hard to replicate, but it seems that the loop bound is not safely clipped.

@orottier orottier changed the title Error Panic in AudioBufferSourceNode Aug 27, 2024
@orottier
Copy link
Collaborator

Hi @jipodine, thanks for flagging this with us. This is probably an issue with the underlying rust audio implementation.
You say it is hard to replicate, but could you provide us with some more details:

  • which version are you running?
  • which loop parameters are set? (loop, loopStart, loopEnd)
  • what start call was made? start(when, offset, duration)
  • which of the audio params are set? (detune, playbackrate)
  • does it panic at the first loop iterations, or after several?

@jipodine
Copy link
Author

jipodine commented Aug 27, 2024 via email

@jipodine
Copy link
Author

It might also be that I played the sound in loop for a long time: like 2 hours for a 1 minute buffer.

@b-ma
Copy link
Collaborator

b-ma commented Aug 27, 2024

Hey, thanks for the feedback

@otto, rapidly checking the Rust code, unless I missed something it seems we don't actually make all the checks and clamping defined here: https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-start-when-offset-duration-offset, can you have another look?

@orottier
Copy link
Collaborator

Sure, I'm having a look.

I'm writing a fuzzer now that tests the whole range of possible configurations, and I have already found a case where processing hangs indefinitely. I have yet to track the panic condition, but will indeed look at clamping first.

@jipodine
Copy link
Author

About clamping, #135 might be related.

@orottier
Copy link
Collaborator

orottier commented Sep 3, 2024

Apologies, I have not been able to spend a lot of time on this.
I added a comment to #135 which I believe is not directly related (but thanks for flagging!)
I have not been able to reproduce the panic. Clamping appears to be handled in both the fast-path the not-fast-path.
TBC

@b-ma
Copy link
Collaborator

b-ma commented Sep 20, 2024

(hopefully) fixed in v0.21.2

Let's re-open if we see it again

@b-ma b-ma closed this as completed Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants