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

webaudio panic playing Master Archer #26271

Open
jdm opened this issue Apr 22, 2020 · 2 comments
Open

webaudio panic playing Master Archer #26271

jdm opened this issue Apr 22, 2020 · 2 comments
Labels
A-content/webaudio I-panic Servo encounters a panic.

Comments

@jdm
Copy link
Member

jdm commented Apr 22, 2020

joshmatthews@joshmatthews-fcmd6r servo % ./mach run -r https://playcanv.as/p/JERg21J8/
Powered by PlayCanvas 0.205.0 5ad0fae
[2020-04-22T15:40:02Z ERROR script::dom::bindings::error] Error at https://playcanv.as/p/JERg21J8/:97:34 iframe.contentWindow.focus is not a function
Message from PlayCanvas: The element component is currently in Beta. APIs may change without notice.
index out of bounds: the len is 0 but the index is 0 (thread AudioRenderThread, at /rustc/45ebd5808afd3df7ba842797c0fcd4447ddf30fb/src/libcore/slice/mod.rs:2842)
stack backtrace:
   0: <servo::backtrace::Print as core::fmt::Debug>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: servo::backtrace::print
   4: servo::main::{{closure}}
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::panicking::panic_bounds_check
   9: servo_media_audio::buffer_source_node::AudioBuffer::interpolate
  10: <servo_media_audio::buffer_source_node::AudioBufferSourceNode as servo_media_audio::node::AudioNodeEngine>::process
  11: servo_media_audio::graph::AudioGraph::process
  12: servo_media_audio::render_thread::AudioRenderThread::event_loop
  13: servo_media_audio::render_thread::AudioRenderThread::start
  14: std::sys_common::backtrace::__rust_begin_short_backtrace
  15: core::ops::function::FnOnce::call_once{{vtable.shim}}
  16: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
  17: std::sys::unix::thread::Thread::new::thread_start
  18: _pthread_start
[2020-04-22T15:40:05Z ERROR servo] index out of bounds: the len is 0 but the index is 0
called `Result::unwrap()` on an `Err` value: RecvError (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(1), index: PipelineIndex(1) }, at /Users/joshmatthews/.cargo/git/checkouts/media-c23a3cd5aa97076a/03c7420/audio/context.rs:188)
stack backtrace:
   0: <servo::backtrace::Print as core::fmt::Debug>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: servo::backtrace::print
   4: servo::main::{{closure}}
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::option::expect_none_failed
   9: servo_media_audio::context::AudioContext::current_time
  10: <script::dom::baseaudiocontext::BaseAudioContext as script::dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextBinding::BaseAudioContextMethods>::CurrentTime
  11: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  12: script::dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContextBinding::get_currentTime
  13: script::dom::bindings::utils::generic_call
  14: _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructENS_10CallReasonE
  15: _ZN2js10CallGetterEP9JSContextN2JS6HandleINS2_5ValueEEES5_NS2_13MutableHandleIS4_EE
  16: _ZN2js17NativeGetPropertyEP9JSContextN2JS6HandleIPNS_12NativeObjectEEENS3_INS2_5ValueEEENS3_INS2_11PropertyKeyEEENS2_13MutableHandleIS7_EE
  17: _ZN2js11GetPropertyEP9JSContextN2JS6HandleINS2_5ValueEEENS3_IPNS_12PropertyNameEEENS2_13MutableHandleIS4_EE
  18: _ZL9InterpretP9JSContextRN2js8RunStateE
  19: _ZN2js9RunScriptEP9JSContextRNS_8RunStateE
  20: _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructENS_10CallReasonE
  21: _ZN2js4CallEP9JSContextN2JS6HandleINS2_5ValueEEES5_RKNS_13AnyInvokeArgsENS2_13MutableHandleIS4_EENS_10CallReasonE
  22: _ZN2js3jit14InvokeFunctionEP9JSContextN2JS6HandleIP8JSObjectEEbbjPNS3_5ValueENS3_13MutableHandleIS8_EE
  23: _ZN2js3jit25InvokeFromInterpreterStubEP9JSContextPNS0_30InterpreterStubExitFrameLayoutE
[2020-04-22T15:40:05Z ERROR servo] called `Result::unwrap()` on an `Err` value: RecvError
@jdm jdm added I-panic Servo encounters a panic. A-content/webaudio labels Apr 22, 2020
@jdm
Copy link
Member Author

jdm commented Apr 22, 2020

Also seen on https://playcanv.as/p/Ikq6Uk6A/.

@Eijebong
Copy link
Contributor

Eijebong commented May 4, 2020

Removing the else here fixes the crash. https://github.com/servo/media/blob/62cd58a94c54e8d9ff3845f263356e242e951686/audio/buffer_source_node.rs#L304

We get in that method with loop_enabled = true, but both buffer.len() and pos end up being equal to 0.

(gdb) info locals
sample = 0x7fff8662c000
__next = 0x7fff8662c000
iter = core::slice::IterMut<f32> {ptr: core::ptr::non_null::NonNull<f32> {pointer: 0x7fff8662c004}, end: 0x7fff8662c200, _marker: core::marker::PhantomData<&mut f32>}
duration = inf
pos = 0
data = &mut [f32] {data_ptr: 0x7fff8662c000, length: 128}
data = &mut [f32] {data_ptr: 0x7fff8662c000, length: 128}
data = &mut [f32] {data_ptr: 0x7fff8662c000, length: 128}
chan = 0
__next = 0
iter = core::ops::range::Range<u8> {start: 1, end: 2}
block = servo_media_audio::block::Block {channels: 2, repeat: false, buffer: alloc::vec::Vec<f32> {buf: alloc::raw_vec::RawVec<f32, alloc::alloc::Global> {ptr: core::ptr::unique::Unique<f32> {pointer: 0x7fff8662c000, _marker: core::marker::PhantomData<f32>}, cap: 256, alloc: alloc::alloc::Global}, len: 256}}
frames_to_output = 128
buffer_offset_per_tick = 1
forward = true
computed_playback_rate = 1
actual_loop_start = 0
actual_loop_end = 0
buffer = 0x7fff86617180
start_at = 0
stop_at = 128

Here are the locals at the beginning of the block.

And at the end

sample = 0x7fff8662c000
__next = 0x7fff8662c000
iter = core::slice::IterMut<f32> {ptr: core::ptr::non_null::NonNull<f32> {pointer: 0x7fff8662c004}, end: 0x7fff8662c200, _marker: core::marker::PhantomData<&mut f32>}
duration = inf
pos = 0
data = &mut [f32] {data_ptr: 0x7fff8662c000, length: 128}
data = &mut [f32] {data_ptr: 0x7fff8662c000, length: 128}
data = &mut [f32] {data_ptr: 0x7fff8662c000, length: 128}
chan = 0
__next = 0
iter = core::ops::range::Range<u8> {start: 1, end: 2}
block = servo_media_audio::block::Block {channels: 2, repeat: false, buffer: alloc::vec::Vec<f32> {buf: alloc::raw_vec::RawVec<f32, alloc::alloc::Global> {ptr: core::ptr::unique::Unique<f32> {pointer: 0x7fff8662c
000, _marker: core::marker::PhantomData<f32>}, cap: 256, alloc: alloc::alloc::Global}, len: 256}}
frames_to_output = 128
buffer_offset_per_tick = 1
forward = true
computed_playback_rate = 1
actual_loop_start = 0
actual_loop_end = 0
buffer = 0x7fff86617180
start_at = 0
stop_at = 128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/webaudio I-panic Servo encounters a panic.
Projects
None yet
Development

No branches or pull requests

2 participants