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

Plugin crashes without any further information

Open drewhk opened this issue 2 years ago • 2 comments

The plugin I develop simply crashes on load, but unfortunately I cannot find out how. I added logging in my plugin and all I can see is that my Param's default is executed, but it never gets to my initialize method at all. The only thing I see in the log is:

12:54:41 [INFO] weierstrass: Load default
12:54:41 [TRACE] (1) nih_plug::wrapper::vst3::wrapper: [C:\Users\drewh\.cargo\git\checkouts\nih-plug-a2d2dc277b128e13\7a01b57\src\wrapper\vst3\wrapper.rs:486] Saved state (43 bytes)

and then no log coming from the initializer at all. It seems like NIH-Plug itself crashes somewhere before the initializer is even called. NB: I tried even removing all fields from my params to ensure no problems are in the params themselves, but the issue is still the same.

drewhk avatar Feb 15 '24 11:02 drewhk

can confirm, running my plugin in standalone mode spits out a stack overflow with no further information

murl-digital avatar Feb 21 '24 17:02 murl-digital

after some extra investigating, it seems like the default function is being called on the plugin infinitely, then stack overflows. i'm looking into the standalone wrapper to see if i can figure out the culprit.

murl-digital avatar Feb 23 '24 18:02 murl-digital

Might be the same issue as https://github.com/magnetophon/lamb-rs/issues/4, with an lldb output. Thanks @bboettcher3, also for pointing me at this issue!

magnetophon avatar Apr 02 '24 18:04 magnetophon

Some backtrace info from lldb after the crash for the lamb standalone:



``* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x16f525bf0)
  * frame #0: 0x000000010013cac0 lamb`_$LT$lamb..Lamb$u20$as$u20$core..default..Default$GT$::default::h494893d9fe27395a at lib.rs:38
    frame #1: 0x00000001000ea9e4 lamb`nih_plug::wrapper::standalone::wrapper::Wrapper$LT$P$C$B$GT$::new::h8f2af64ad4e33366(backend=CpalMidir @ 0x000000016fdfc5d0, config=WrapperConfig @ 0x000000016fdfc7a8) at wrapper.rs:184:26
    frame #2: 0x000000010003d83c lamb`nih_plug::wrapper::standalone::run_wrapper::h2055adf44f363093(backend=<unavailable>, config=<unavailable>) at standalone.rs:179:25
    frame #3: 0x000000010003e7b0 lamb`nih_plug::wrapper::standalone::nih_export_standalone_with_args::_$u7b$$u7b$closure$u7d$$u7d$::h5691748ed3a623fd((null)=Error @ 0x000000016fdfc0f0) at standalone.rs:102:28
    frame #4: 0x00000001000277e0 lamb`core::result::Result$LT$T$C$E$GT$::or_else::he0e4a54bcbbd14c9(self=Result<bool, anyhow::Error> @ 0x000000016fdfd5d0, op={closure_env#2}<lamb::Lamb, std::env::Args> @ 0x000000016fdfca38) at result.rs:1382:23
    frame #5: 0x000000010003dda0 lamb`nih_plug::wrapper::standalone::nih_export_standalone_with_args::h4f816ad54eee598e(args=Args @ 0x000000016fdfe9d0) at standalone.rs:98:26
    frame #6: 0x000000010003db6c lamb`nih_plug::wrapper::standalone::nih_export_standalone::haa2a5b11516ff0be at standalone.rs:53:5
    frame #7: 0x0000000100018278 lamb`lamb::main::h82bb5efe9a94f170 at main.rs:6:5
    frame #8: 0x00000001000f8b0c lamb`core::ops::function::FnOnce::call_once::h768a950d91759667((null)=(lamb`lamb::main::h82bb5efe9a94f170 at main.rs:5), (null)=<unavailable>) at function.rs:250:5
    frame #9: 0x000000010003b128 lamb`std::sys_common::backtrace::__rust_begin_short_backtrace::h7fcd8caa1533d657(f=(lamb`lamb::main::h82bb5efe9a94f170 at main.rs:5)) at backtrace.rs:154:18
    frame #10: 0x0000000100059500 lamb`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hf2200825f9762f82 at rt.rs:167:18
    frame #11: 0x0000000100bcc41c lamb`std::rt::lang_start_internal::h5b246d44f1526226 [inlined] core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::h1a7c0e059d971da5 at function.rs:284:13 [opt]
    frame #12: 0x0000000100bcc414 lamb`std::rt::lang_start_internal::h5b246d44f1526226 [inlined] std::panicking::try::do_call::h07a34a23e615022b at panicking.rs:552:40 [opt]
    frame #13: 0x0000000100bcc414 lamb`std::rt::lang_start_internal::h5b246d44f1526226 [inlined] std::panicking::try::h1111644420b4cc09 at panicking.rs:516:19 [opt]
    frame #14: 0x0000000100bcc414 lamb`std::rt::lang_start_internal::h5b246d44f1526226 [inlined] std::panic::catch_unwind::h31a3b9d6e2ef9973 at panic.rs:142:14 [opt]
    frame #15: 0x0000000100bcc414 lamb`std::rt::lang_start_internal::h5b246d44f1526226 [inlined] std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::h63c3452500a36531 at rt.rs:148:48 [opt]
    frame #16: 0x0000000100bcc414 lamb`std::rt::lang_start_internal::h5b246d44f1526226 [inlined] std::panicking::try::do_call::h9c5c8a2a0a297bb7 at panicking.rs:552:40 [opt]
    frame #17: 0x0000000100bcc410 lamb`std::rt::lang_start_internal::h5b246d44f1526226 [inlined] std::panicking::try::h424cfcafca1bde97 at panicking.rs:516:19 [opt]
    frame #18: 0x0000000100bcc410 lamb`std::rt::lang_start_internal::h5b246d44f1526226 [inlined] std::panic::catch_unwind::h345d3d448041017f at panic.rs:142:14 [opt]
    frame #19: 0x0000000100bcc410 lamb`std::rt::lang_start_internal::h5b246d44f1526226 at rt.rs:148:20 [opt]
    frame #20: 0x00000001000594cc lamb`std::rt::lang_start::h1e8d4a24c9e76ef7(main=(lamb`lamb::main::h82bb5efe9a94f170 at main.rs:5), argc=1, argv=0x000000016fdfee48, sigpipe='\0') at rt.rs:166:17
    frame #21: 0x00000001000182a4 lamb`main + 36
    frame #22: 0x000000018c22d058 dyld`start + 2224

bboettcher3 avatar Apr 02 '24 19:04 bboettcher3

Also able to confirm that the Gain example runs fine in standalone, so is probably not a nih-plug bug directly.

bboettcher3 avatar Apr 02 '24 20:04 bboettcher3

The crash @bboettcher3 and me where getting seems unrelated as it was fixed by using the faust part of my plugin differently: https://github.com/magnetophon/lamb-rs/commit/44046aafb34621b607bacfc85ee45a91152424e9

magnetophon avatar Apr 12 '24 18:04 magnetophon

I think my issue is unrelated to @magnetophon or @bboettcher3 , however, it seems like it went away since I last checked - I guess it was fixed somehow? @murl-digital does it work for you now? If yes then we can close this ticket.

drewhk avatar Apr 22 '24 07:04 drewhk

Mine was unrelated, and was actually caused by me being silly with ..Default::default() and causing a stack overflow

Since this seems like just a mysterious catch-all issue I think it's safe to close

murl-digital avatar Apr 22 '24 14:04 murl-digital