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

Crash when using automation with ReaLearn parameters #59

Closed
helgoboss opened this issue Dec 8, 2020 · 2 comments
Closed

Crash when using automation with ReaLearn parameters #59

helgoboss opened this issue Dec 8, 2020 · 2 comments
Labels
bug Something isn't working realearn Related to ReaLearn
Milestone

Comments

@helgoboss
Copy link
Owner

When drawing some envelopes using ReaLearn's built-in parameters and then changing to Latch (maybe also other automation mode), this error occurs and REAPER even crashes (also see user issue #43):

Module name:         ReaLearn
Module version:      v1.12.0-pre6/x86_64 rev f505d4 (2020-12-08 01:30:21 UTC)
Module base address: 0x7ffac8170000
Module size:         0xa03000

Message: already mutably borrowed: BorrowError

   0:     0x7ffac8771e0d - Extended
   1:     0x7ffac876f9d9 - Extended
   2:     0x7ffac86845b8 - MAIN
   3:     0x7ffac878fe78 - Extended
   4:     0x7ffac878f9cf - Extended
   5:     0x7ffac87a2d70 - rust_eh_personality
   6:     0x7ffac87a2bd3 - rust_eh_personality
   7:     0x7ffac8335a55 - MAIN
   8:        0x140813c4e - <unknown>
   9:        0x14034f2da - <unknown>
  10:        0x1402705e5 - <unknown>
  11:        0x1402702f2 - <unknown>
  12:        0x140191880 - <unknown>
  13:        0x140190ab4 - <unknown>
  14:        0x1403aadef - <unknown>
  15:     0x7ffb1e672920 - ScreenToClient
  16:     0x7ffb1e6720c2 - ScreenToClient
  17:     0x7ffb1e6b9f89 - UnpackDDElParam
  18:     0x7ffb1e66e858 - CallWindowProcW
  19:     0x7ffb1e66e299 - DispatchMessageW
  20:        0x1403a4811 - <unknown>
  21:        0x140861391 - <unknown>
  22:     0x7ffb1e5b7034 - BaseThreadInitThunk
  23:     0x7ffb2057d0d1 - RtlUserThreadStart
--- cut ---
@helgoboss helgoboss added the bug Something isn't working label Dec 8, 2020
@helgoboss helgoboss added this to the 1.12.0 milestone Dec 8, 2020
@helgoboss
Copy link
Owner Author

Backtrace with symbols resolved:

Attempting to resolve symbols for 24 addresses
==============================================
        
0: 7ffac8771e0d
-----------------------------------
            
Relative: Some(601e0d)
Ours absolute: Some(7ffac8771e0d)

7ffac8771d80
backtrace::backtrace::trace<closure-0>
C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.53\src\backtrace\mod.rs (line 53)


1: 7ffac876f9d9
-----------------------------------
            
Relative: Some(5ff9d9)
Ours absolute: Some(7ffac876f9d9)

7ffac876f980
backtrace::capture::Backtrace::new
C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.53\src\capture.rs (line 140)


2: 7ffac86845b8
-----------------------------------
            
Relative: Some(5145b8)
Ours absolute: Some(7ffac86845b8)

7ffac8684580
reaper_high::log_util::create_reaper_panic_hook::{{closure}}<closure-0>
C:\Users\runneradmin\.cargo\git\checkouts\reaper-rs-d32fed07113e6874\7596234\main\high\src\log_util.rs (line 51)


3: 7ffac878fe78
-----------------------------------
            
Relative: Some(61fe78)
Ours absolute: Some(7ffac878fe78)

7ffac878fd10
std::panicking::rust_panic_with_hook
/rustc/a74d1862d4d87a56244958416fd05976c58ca1a8\/src\libstd\panicking.rs (line 481)


4: 7ffac878f9cf
-----------------------------------
            
Relative: Some(61f9cf)
Ours absolute: Some(7ffac878f9cf)

7ffac878f940
std::panicking::begin_panic_handler
/rustc/a74d1862d4d87a56244958416fd05976c58ca1a8\/src\libstd\panicking.rs (line 385)


5: 7ffac87a2d70
-----------------------------------
            
Relative: Some(632d70)
Ours absolute: Some(7ffac87a2d70)

7ffac87a2d40
core::panicking::panic_fmt
/rustc/a74d1862d4d87a56244958416fd05976c58ca1a8\/src\libcore\panicking.rs (line 89)


6: 7ffac87a2bd3
-----------------------------------
            
Relative: Some(632bd3)
Ours absolute: Some(7ffac87a2bd3)

7ffac87a2b40
core::option::expect_none_failed
/rustc/a74d1862d4d87a56244958416fd05976c58ca1a8\/src\libcore\option.rs (line 1272)


7: 7ffac8335a55
-----------------------------------
            
Relative: Some(1c5a55)
Ours absolute: Some(7ffac8335a55)

7ffac8335980
realearn::infrastructure::plugin::realearn_plugin_parameters::{{impl}}::get_parameter
D:\a\realearn\realearn\main\src\infrastructure\plugin\realearn_plugin_parameters.rs (line 118)


15: 7ffb1e672920
-----------------------------------
            
Relative: None
Ours absolute: None

7ffb1e671d60
ScreenToClient


16: 7ffb1e6720c2
-----------------------------------
            
Relative: None
Ours absolute: None

7ffb1e671d60
ScreenToClient


17: 7ffb1e6b9f89
-----------------------------------
            
Relative: None
Ours absolute: None

7ffb1e6b9630
UnpackDDElParam


18: 7ffb1e66e858
-----------------------------------
            
Relative: None
Ours absolute: None

7ffb1e66e460
CallWindowProcW


19: 7ffb1e66e299
-----------------------------------
            
Relative: None
Ours absolute: None

7ffb1e66e040
DispatchMessageW


22: 7ffb1e5b7034
-----------------------------------
            
Relative: None
Ours absolute: None

7ffb1e5b7020
BaseThreadInitThunk


23: 7ffb2057d0d1
-----------------------------------
            
Relative: None
Ours absolute: None

7ffb2057d0b0
RtlUserThreadStart

@helgoboss
Copy link
Owner Author

Seems to happen only if mapping window open and automation mode set to latch. The REAPER crash occurs because at the moment we don't catch_unwind the panic - this is the first thing we should introduce.

Even better backtrace:

       9:     0x7ffaa159fd91 - core::result::Result<core::cell::RefMut<realearn::application::session::Session>, core::cell::BorrowMutError>::expect<core::cell::RefMut<realearn::application::session::Session>,core::cell::BorrowMutError>
                                   at C:\Users\benja\.rustup\toolchains\nightly-2020-05-15-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\result.rs:963
      10:     0x7ffaa17cec30 - core::cell::RefCell<realearn::application::session::Session>::borrow_mut<realearn::application::session::Session>
                                   at C:\Users\benja\.rustup\toolchains\nightly-2020-05-15-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\cell.rs:878
      11:     0x7ffaa18ecf50 - realearn::infrastructure::plugin::realearn_plugin_parameters::{{impl}}::set_parameter
                                   at C:\Users\benja\Documents\projects\dev\realearn-rs\main\src\infrastructure\plugin\realearn_plugin_parameters.rs:126
      12:     0x7ffaa23994fb - vst::interfaces::set_parameter
                                   at C:\Users\benja\.cargo\git\checkouts\vst-rs-8c46934a2d9a5311\8cb5571\src\interfaces.rs:59
      13:        0x14080a0a3 - <unknown>
      14:        0x140346442 - <unknown>
      15:        0x140344778 - <unknown>
      16:        0x14036b1b1 - <unknown>
      17:        0x1406ee8fd - <unknown>
      18:        0x1406f68a7 - <unknown>
      19:        0x1406ed1c8 - <unknown>
      20:        0x1404ccca9 - <unknown>
      21:        0x1404cb399 - <unknown>
      22:        0x1404ca443 - <unknown>
      23:        0x14003e0ea - <unknown>
      24:        0x140856087 - <unknown>
      25:        0x14085615f - <unknown>
      26:     0x7ffb1e5b7034 - BaseThreadInitThunk
      27:     0x7ffb2057d0d1 - RtlUserThreadStart
    , message: already borrowed: BorrowMutError

helgoboss added a commit that referenced this issue Dec 10, 2020
`RealearnPluginParameters::set_parameters()` is usually called by non-main thread!
That's why session access in this method is actually a no-go. Now
`RealearnPluginParameters` is the canonical owner of the parameter array and syncs
it directly to the processor via channel. The session doesn't know the parameter
values anymore (it doesn't need to know them). `ActivationCondition` API was
adjusted accordingly. In addition to having solved the race condition, things should
be much better decoupled now.
@helgoboss helgoboss added the realearn Related to ReaLearn label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working realearn Related to ReaLearn
Projects
None yet
Development

No branches or pull requests

1 participant