nih-plug icon indicating copy to clipboard operation
nih-plug copied to clipboard

Crash on Debian/Ubuntu when opening UI twice

Open PolyVector opened this issue 2 years ago • 2 comments

plugins seem to crash on Debian/Ubuntu when opening the UI a second time (CLAP or VST3). I've had reports of this in Reaper/Bitwig on Ubuntu 22.04, and was able to confirm it myself on Debian 11 with Reaper 7.0.6. ~~I haven't seen it at all on Arch/Manjaro for some reason~~

Here's a stack trace of the Egui Gain Example plugin, running in Reaper 7.0.6 on Debian 11:

(gdb) bt
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007fffaa1f3e64 in std::sys::unix::futex::futex_wait () at library/std/src/sys/unix/futex.rs:62
#2  std::sys_common::thread_parking::futex::Parker::park () at library/std/src/sys_common/thread_parking/futex.rs:52
#3  std::thread::park () at library/std/src/thread/mod.rs:1068
#4  0x00007fffa9d00536 in std::sync::mpmc::context::Context::wait_until (self=0x7fffffff9598, deadline=...)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/mpmc/context.rs:139
#5  0x00007fffa9ca300c in std::sync::mpmc::array::{impl#1}::recv::{closure#1}<core::result::Result<baseview::x11::window::SendableRwh, ()>> (cx=0x7fffffff9598) at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/mpmc/array.rs:397
#6  0x00007fffa9c6fa68 in std::sync::mpmc::context::{impl#0}::with::{closure#0}<std::sync::mpmc::array::{impl#1}::recv::{closure_env#1}<core::result::Result<baseview::x11::window::SendableRwh, ()>>, ()> (cx=0x7fffffff9598)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/mpmc/context.rs:50
#7  0x00007fffa9c6f765 in std::sync::mpmc::context::{impl#0}::with::{closure#1}<std::sync::mpmc::array::{impl#1}::recv::{closure_env#1}<core::result::Result<baseview::x11::window::SendableRwh, ()>>, ()> (cell=0x2ebdb50)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/mpmc/context.rs:58
#8  0x00007fffa9c9f11b in std::thread::local::LocalKey<core::cell::Cell<core::option::Option<std::sync::mpmc::context::Context>>>::try_with<core::cell::Cell<core::option::Option<std::sync::mpmc::context::Context>>, std::sync::mpmc::context::{impl#0}::with::{closure_env#1}<std::sync::mpmc::array::{impl#1}::recv::{closure_env#1}<core::result::Result<baseview::x11::window::SendableRwh, ()>>, ()>, ()>
    (self=0x7fffaa4d36d8, f=...) at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/thread/local.rs:270
#9  0x00007fffa9c6e6de in std::sync::mpmc::context::Context::with<std::sync::mpmc::array::{impl#1}::recv::{closure_env#1}<core::result::Result<baseview::x11::window::SendableRwh, ()>>, ()> (f=...)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/mpmc/context.rs:53
#10 0x00007fffa9ca2edb in std::sync::mpmc::array::Channel<core::result::Result<baseview::x11::window::SendableRwh, ()>>::recv<core::result::Result<baseview::x11::window::SendableRwh, ()>> (self=0x1682400, deadline=...)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/mpmc/array.rs:386
#11 0x00007fffa9c5847b in std::sync::mpmc::Receiver<core::result::Result<baseview::x11::window::SendableRwh, ()>>::recv<core::result::Result<baseview::x11::window::SendableRwh, ()>> (self=0x7fffffff99c0)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/mpmc/mod.rs:306
#12 0x00007fffa9d2d5b7 in std::sync::mpsc::Receiver<core::result::Result<baseview::x11::window::SendableRwh, ()>>::recv<core::result::Result<baseview::x11::window::SendableRwh, ()>> (self=0x7fffffff99c0)
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sync/mpsc/mod.rs:849
#13 0x00007fffa9c9ffb5 in baseview::x11::window::Window::open_parented<nih_plug::editor::ParentWindowHandle, egui_baseview::window::EguiWindow<alloc::sync::Arc<lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, ()>, alloc::alloc::Global>, nih_plug_egui::editor::{impl#0}::spawn::{closure_env#2}<()>>, egui_baseview::window::{impl#2}::open_parented::{closure_env#0}<alloc::sync::Arc<lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, ()>, alloc::alloc::Global>, nih_plug_egui::editor::{impl#0}::spawn::{closure_env#2}<()>, nih_plug::editor::ParentWindowHandle, nih_plug_egui::editor::{impl#0}::spawn::{closure_env#1}<()>>>
    (parent=0x7fffffffa310, options=..., build=...)
    at /home/skunkie/.cargo/git/checkouts/baseview-9d6c750431f4479e/1d9806d/src/x11/window.rs:143
#14 0x00007fffa9c642cd in baseview::window::Window::open_parented<nih_plug::editor::ParentWindowHandle, egui_baseview::window::EguiWindow<alloc::sync::Arc<lock_api::rwlock::RwLock<parking_lot::raw_rwlock::RawRwLock, ()>, alloc::alloc::Global>, nih_plug_egui::editor::{impl#0}::spawn

~~The issue appears to have started at this commit: eb968ba44666d96cb2349ad877fcdcbccb993f8c~~ (still crashes before this)

Edit: This seems to likely be a baseview issue: https://github.com/RustAudio/baseview/issues/142

Edit: I have now seen this on Manjaro as well. It took about 300 open/close cycles, but this may be because I have a lot of RAM/VRAM, and my Debian/Ubuntu tests were on more limited VMs. As far as I can tell, this is just a baseview bug/leak, probably a duplicate of: https://github.com/robbert-vdh/nih-plug/issues/93

Edit: This apparently happens with VIZIA as well.

PolyVector avatar Dec 11 '23 22:12 PolyVector

Similar crash is happening to me on Studio One (Studio One 5.5.2.86528 Win x64). The 1st instance was dragged and dropped onto a bus channel and it works fine. When I tried to add an additional instance (via drag/drop or choosing from list) onto a different audio channel, the DAW crashes and I need to re-open it. I'm using the [2024-05-05-230535-windows.zip] version of the VST3 plugin. I have a PreSonus diagnostic crash report if anyone is interested. Edit: This happens every time I try adding a 2nd instance, so very repeatable.

rrauvola avatar May 15 '24 18:05 rrauvola

We've been getting more reports of this with our Linux plugins in Debian+Reaper. It can be triggered with iced, vizia, and egui examples, as well as the Spectral Compressor plugin. I simply open and close the UI a few times and it usually goes blank or crashes. Pretty sure it's a baseview issue from these two errors:

BadDrawable: 10:10:30 [ERROR] thread 'unnamed' panicked at 'called Result::unwrap()on anErr value: XLibError { error_code: 9, error_message: "BadDrawable (invalid Pixmap or Window parameter)", minor_code: 3, request_code: 130, type: 0, resource_id: 65011716, serial: 302 }': /home/skunkie/.cargo/git/checkouts/baseview-9d6c750431f4479e/2c1b1a7/src/gl/x11.rs:236

and BadRequest: 10:10:31 [ERROR] thread 'unnamed' panicked at 'called Result::unwrap()on anErr value: XLibError { error_code: 1, error_message: "BadRequest (invalid request code or no such operation)", minor_code: 0, request_code: 0, type: 0, resource_id: 65011716, serial: 65 }': /home/skunkie/.cargo/git/checkouts/baseview-9d6c750431f4479e/2c1b1a7/src/gl/x11.rs:236

PolyVector avatar Jun 03 '24 17:06 PolyVector