Jack CpalCapture Panic
Running Camilla (next31 branch), with Jack, I am not able to get a stable startup of CamillaDSP.
Here is the startup log.
root@cardia:/home/aris/proj# camilladsp/target/debug/camilladsp config/v8-96khz.yml 2025-03-30 23:27:21.581836 INFO [camilladsp] <src/bin.rs:794> CamillaDSP version 4.0.0-draft 2025-03-30 23:27:21.581872 INFO [camilladsp] <src/bin.rs:795> Running on linux, x86_64 2025-03-30 23:27:22.198192 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.198188 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.198218 WARN [camillalib::cpaldevice] <src/cpaldevice.rs:334> Playback interrupted, no data available 2025-03-30 23:27:22.283558 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.283558 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.283657 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.283664 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.368949 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.368948 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.369030 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.369034 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.454240 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.454233 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.454320 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.454322 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.539575 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.539576 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.539686 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.539689 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.641067 INFO [camillalib::cpaldevice] <src/cpaldevice.rs:324> Restarting playback after buffer underrun 2025-03-30 23:27:22.696511 WARN [camillalib::cpaldevice] <src/cpaldevice.rs:334> Playback interrupted, no data available 2025-03-30 23:27:22.700993 INFO [camillalib::cpaldevice] <src/cpaldevice.rs:324> Restarting playback after buffer underrun 2025-03-30 23:27:22.756455 WARN [camillalib::cpaldevice] <src/cpaldevice.rs:334> Playback interrupted, no data available 2025-03-30 23:27:22.761152 INFO [camillalib::cpaldevice] <src/cpaldevice.rs:324> Restarting playback after buffer underrun 2025-03-30 23:27:22.880869 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.880922 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:22.934545 WARN [camillalib::cpaldevice] <src/cpaldevice.rs:334> Playback interrupted, no data available 2025-03-30 23:27:22.939870 INFO [camillalib::cpaldevice] <src/cpaldevice.rs:324> Restarting playback after buffer underrun ^C2025-03-30 23:27:22.990877 INFO [camilladsp] <src/bin.rs:1006> Shutting down 2025-03-30 23:27:23.008880 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:353> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:23.008893 ERROR [camillalib::cpaldevice] <src/cpaldevice.rs:536> an error occurred on stream: A backend-specific error has occurred: xrun (buffer over or under run) 2025-03-30 23:27:23.054032 WARN [camillalib::cpaldevice] <src/cpaldevice.rs:334> Playback interrupted, no data available 2025-03-30 23:27:23.059481 INFO [camillalib::cpaldevice] <src/cpaldevice.rs:324> Restarting playback after buffer underrun
thread 'CpalCapture' panicked at /home/aris/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-channel-0.5.14/src/waker.rs:272:9:
assertion failed: self.is_empty.load(Ordering::SeqCst)
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'CpalCapture' panicked at /home/aris/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-channel-0.5.14/src/waker.rs:170:9:
assertion left == right failed
left: 1
right: 0
stack backtrace:
0: 0x560cdf6a8189 - std::backtrace_rs::backtrace::libunwind::trace::h957dbee4cbd782c0
at /usr/src/rustc-1.85.0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
1: 0x560cdf6a8189 - std::backtrace_rs::backtrace::trace_unsynchronized::he911a28549105692
at /usr/src/rustc-1.85.0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x560cdf6a8189 - std::sys::backtrace::_print_fmt::h13bda53c948a9e3a
at /usr/src/rustc-1.85.0/library/std/src/sys/backtrace.rs:66:9
3: 0x560cdf6a8189 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::he621b98f63f9d3d7
at /usr/src/rustc-1.85.0/library/std/src/sys/backtrace.rs:39:26
4: 0x560cdf6b77d3 - core::fmt::rt::Argument::fmt::hae6b0c0f8268a146
at /usr/src/rustc-1.85.0/library/core/src/fmt/rt.rs:177:76
5: 0x560cdf6b77d3 - core::fmt::write::hde6dfded0b3527b3
at /usr/src/rustc-1.85.0/library/core/src/fmt/mod.rs:1440:21
6: 0x560cdf69889f - std::io::Write::write_fmt::h36296b2095d435c5
at /usr/src/rustc-1.85.0/library/std/src/io/mod.rs:1887:15
7: 0x560cdf6a7fd3 - std::sys::backtrace::BacktraceLock::print::h6afc11248184a26d
at /usr/src/rustc-1.85.0/library/std/src/sys/backtrace.rs:42:9
8: 0x560cdf678555 - std::panicking::default_hook::{{closure}}::h10a0643748605a95
9: 0x560cdf678348 - std::panicking::default_hook::hd325ab9c425e39f5
at /usr/src/rustc-1.85.0/library/std/src/panicking.rs:322:9
10: 0x560cdf678b2f - std::panicking::rust_panic_with_hook::h971cc6030e2a4c0c
at /usr/src/rustc-1.85.0/library/std/src/panicking.rs:828:13
11: 0x560cdf6a859a - std::panicking::begin_panic_handler::{{closure}}::h2e190a4e7de13958
at /usr/src/rustc-1.85.0/library/std/src/panicking.rs:701:13
12: 0x560cdf6a83c9 - std::sys::backtrace::__rust_end_short_backtrace::hcd8ac5f0f2c9f590
at /usr/src/rustc-1.85.0/library/std/src/sys/backtrace.rs:168:18
13: 0x560cdf67869d - rust_begin_unwind
at /usr/src/rustc-1.85.0/library/std/src/panicking.rs:692:5
14: 0x560cde2abc80 - core::panicking::panic_fmt::h7d0ff9f662980bad
at /usr/src/rustc-1.85.0/library/core/src/panicking.rs:75:14
15: 0x560cde2ac072 - core::panicking::assert_failed_inner::h5c45ea23e132011a
16: 0x560cde2abef9 - core::panicking::assert_failed::h0b05c5c6dd681f21
at /usr/src/rustc-1.85.0/library/core/src/panicking.rs:364:5
17: 0x560cde88ac5d - <crossbeam_channel::waker::Waker as core::ops::drop::Drop>::drop::hea12ecf1bb4756c7
at /home/aris/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crossbeam-channel-0.5.14/src/waker.rs:170:9
18: 0x560cde87dd33 - core::ptr::drop_in_place<crossbeam_channel::waker::Waker>::h09ae7a92ee736c7f
at /usr/src/rustc-1.85.0/library/core/src/ptr/mod.rs:523:1
19: 0x560cde8828db - core::ptr::drop_in_place<core::cell::UnsafeCell<crossbeam_channel::waker::Waker>>::heba8f7127c8e139b
at /usr/src/rustc-1.85.0/library/core/src/ptr/mod.rs:523:1
20: 0x560cde883f2f - core::ptr::drop_in_place<std::sync::poison::mutex::Mutex<crossbeam_channel::waker::Waker>>::h5ed7de61fa9b6769
at /usr/src/rustc-1.85.0/library/core/src/ptr/mod.rs:523:1
21: 0x560cde87ee53 - core::ptr::drop_in_place<crossbeam_channel::waker::SyncWaker>::hfd0aa2c0471aa93b
at /usr/src/rustc-1.85.0/library/core/src/ptr/mod.rs:523:1
22: 0x560cde884c13 - core::ptr::drop_in_place<crossbeam_channel::flavors::array::Channel<alloc::vec::Vec
thread 'CpalCapture' panicked at library/core/src/panicking.rs:226:5: panic in a destructor during cleanup thread caused non-unwinding panic. aborting. Aborted
I also don't think this is a Jack configuration issue - as the same Jackd startup works with another convolver (Brutefir) that I setup as a test.
Operating system is Linux (Debian), Trixie on amd64, Jack2 server/libraries.
The initial xrun / errors are weird also.
For completeness the Jack startup is:
jackd -dalsa -r96000 -p4096 -n2 -D -Chw:Loopback,1 -Phw:HDSPe24081377,0 -i2 -o32
The CamillaDSP configuration is:
devices:
multithreaded: true worker_threads: 8
samplerate: 96000
chunksize: 4096 target_level: 8192
capture: type: Jack device: "default" channels: 2
playback: type: Jack device: "default" channels: 32
And the panic displays when CamillaDSP is Control-C'ed.
That looks a bit messy. Unfortunately I'm having a bit of a challenge with supporting and maintaining all backends. Jack is the most problematic since I really don't know it well and I never use jack. There is never enough time to do everything I want so I have to prioritise, and that's why jack hasn't gotten much attention. At this point I'm more considering to drop jack (and the cpal backend) altogether than improving it. In the longer term I anyway want to drop both jack and pulseaudio, and instead add a Pipewire backend.
Completely understand, and the CPAL based backends are probably used by a comparatively narrower audience group than Wasapi, Alsa and Coreaudio.
I was looking at Jack to see if it exhibited the same issue as #346.
I'm pretty sure that Jack worked on v2 CamillaDSP at some point, maybe it's an upstream issue introduced in one of the crates or libraries.
Overall, the ALSA and CoreAudio backends support small and large channel counts (greater than 8 say). It's only with Wasapi that using devices with higher channel becomes problematic and where ASIO is the only option (on Windows of course).
Without CPAL, and hence ASIO, means there won't be a pathway (or an option for a pathway) for using such devices Windows.
I've searched for a WASAPI-ASIO bridge, but the only thing I can find is proprietary from SonarWorks, as part of one of their products.
Of course, the size of the CamillaDSP audience using devices with greater than 8ch channels is likely to be also small!
I think Pipewire has Jack support, so will probably take care of that, on Linux at least.
I was looking at Jack to see if it exhibited the same issue as #346.
I think that issue is cause by a small mistake when merging different changes to update the asio branch.
I'm pretty sure that Jack worked on v2 CamillaDSP at some point, maybe it's an upstream issue introduced in one of the crates or libraries.
I wouldn't know, I realize that I haven't tried Jack at all since I added the support something like 4 years ago..
Overall, the ALSA and CoreAudio backends support small and large channel counts (greater than 8 say). It's only with Wasapi that using devices with higher channel becomes problematic and where ASIO is the only option (on Windows of course).
It really depends on the driver. Wasapi itself has no problem with large channel counts, but the drivers for many interfaces present them as a bunch of stereo devices. This is the case with my own Motu M4 for example, that shows up as two stereo devices, and is therefore pretty useless for CamillaDSP on Windows. Any interface using the built-in Windows usb audio driver should be ok, but those might be very rare.
Without CPAL, and hence ASIO, means there won't be a pathway (or an option for a pathway) for using such devices Windows.
After looking at this a bit I believe that ASIO via CPAL is never going to work really well. The ASIO api has quite some quirks, and it's very difficult to handle those with an abstractions layer like CPAL in between. So what is needed is a full ASIO backend that interfaces directly with the ASIO api (which unfortunately isn't likely to ever happen).
There is maybe another way. There was an announcement some time ago that Microsoft is working on an improved USB audio driver, that would support many more devices. IIRC it was supposed to become available some time later this year. This will hopefully work with many class compliant devices that require drivers from the manufacturer today, and that should not split the channels up to stereo pairs.
I was looking at Jack to see if it exhibited the same issue as #346.
I think that issue is cause by a small mistake when merging different changes to update the asio branch.
Happy to test if that the case, just let me know.
Using a Wasapi Loopback device (like VAC) for Capture and Asio for Playback seems to be stable modulo the issue in #346 .
Without CPAL, and hence ASIO, means there won't be a pathway (or an option for a pathway) for using such devices Windows.
After looking at this a bit I believe that ASIO via CPAL is never going to work really well. The ASIO api has quite some quirks, and it's very difficult to handle those with an abstractions layer like CPAL in between. So what is needed is a full ASIO backend that interfaces directly with the ASIO api (which unfortunately isn't likely to ever happen).
Agree.
dear siraaris,
jack backend with next31 branch is working without any issues.
I am using jack dummy-driver with zita to connect sound hw
good luck markus
That's really good to hear! What Linux version are you using please?
ubuntu(studio) 24 and jackd 1.21