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

Mandala plugin - First-Trigger-Crash #25

Closed
ErinaceusLinnaeus opened this issue Nov 28, 2024 · 4 comments
Closed

Mandala plugin - First-Trigger-Crash #25

ErinaceusLinnaeus opened this issue Nov 28, 2024 · 4 comments
Assignees

Comments

@ErinaceusLinnaeus
Copy link

Tsunami crashed at the first trigger (4 Zones).
Zone selection was not changed:

Tsunami v2024.10-24-g7368f0f5 "absolute 2er0"

...don't worry. Everything will be fine!

audio library selected: portaudio

midi library selected: coremidi

please note, that portaudio does not support refreshing the device list after program launch

2024-11-28 11:13:37.444 tsunami[20462:3086148] +[IMKClient subclass]: chose IMKClient_Modern

compiling module: plugins/independent/live-performance/Mandala.kaba

capture midi start

================================================================================

program has crashed, error handler has been called... maybe SegFault... m(-_-)m

  trace:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow should only be instantiated on the main thread!'

*** First throw call stack:

(

0 CoreFoundation 0x000000018b334300 __exceptionPreprocess + 176

1 libobjc.A.dylib 0x000000018ae1acd8 objc_exception_throw + 88

2 CoreFoundation 0x000000018b358994 _CFBundleGetValueForInfoKey + 0

3 AppKit 0x000000018edfd5e8 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 260

4 AppKit 0x000000018edfd4d8 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 48

5 AppKit 0x000000018f050f88 -[NSWindow initWithContentRect:styleMask:backing:defer:screen:] + 24

6 libgtk-4.1.dylib 0x00000001080ca10c -[GdkMacosWindow initWithContentRect:styleMask:backing:defer:screen:] + 68

7 libgtk-4.1.dylib 0x00000001080c6ec0 _gdk_macos_toplevel_surface_constructed + 172

8 libgobject-2.0.0.dylib 0x0000000107742a78 g_object_new_internal + 344

9 libgobject-2.0.0.dylib 0x0000000107742700 g_object_new_valist + 1104

10 libgobject-2.0.0.dylib 0x0000000107742030 g_object_new + 32

11 libgtk-4.1.dylib 0x00000001080ff43c gdk_surface_new_toplevel + 84

12 libgtk-4.1.dylib 0x0000000107f730d8 gtk_window_realize + 280

13 libgobject-2.0.0.dylib 0x000000010773c3b8 _g_closure_invoke_va + 212

14 libgobject-2.0.0.dylib 0x000000010775273c signal_emit_valist_unlocked + 1044

15 libgobject-2.0.0.dylib 0x00000001077522fc g_signal_emit_valist + 64

16 libgobject-2.0.0.dylib 0x0000000107752e68 g_signal_emit + 28

17 libgtk-4.1.dylib 0x0000000107f5c780 gtk_widget_realize + 220

18 libgtk-4.1.dylib 0x0000000107f72e24 gtk_window_show + 132

19 libgobject-2.0.0.dylib 0x000000010773c3b8 _g_closure_invoke_va + 212

20 libgobject-2.0.0.dylib 0x000000010775273c signal_emit_valist_unlocked + 1044

21 libgobject-2.0.0.dylib 0x00000001077522fc g_signal_emit_valist + 64

22 libgobject-2.0.0.dylib 0x0000000107752e68 g_signal_emit + 28

23 libgtk-4.1.dylib 0x0000000107f5c2f0 gtk_widget_show + 168

24 tsunami 0x0000000104c11794 _ZN3hui6Window4showEv + 40

25 tsunami 0x0000000104c11ae8 _ZN3hui12fly_and_waitE6sharedINS_6WindowEE + 32

26 tsunami 0x0000000104bb388c _ZN3hui17show_crash_windowEv + 56

27 tsunami 0x0000000104f52c24 _ZN7tsunami12ErrorHandler13error_handlerEv + 184

28 tsunami 0x0000000104bbb3b4 ZNSt3__18__invokeB8ne180100IRPFvvEJEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOS4_DpOS5 + 28

29 tsunami 0x0000000104bbb368 ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callB8ne180100IJRPFvvEEEEvDpOT + 24

30 tsunami 0x0000000104bbb344 _ZNSt3__110__function12__alloc_funcIPFvvENS_9allocatorIS3_EES2_EclB8ne180100Ev + 28

31 tsunami 0x0000000104bba1c8 _ZNSt3__110__function6__funcIPFvvENS_9allocatorIS3_EES2_EclEv + 28

32 tsunami 0x0000000104ae5620 _ZNKSt3__110__function12__value_funcIFvvEEclB8ne180100Ev + 68

33 tsunami 0x0000000104ae54e4 _ZNKSt3__18functionIFvvEEclEv + 24

34 tsunami 0x0000000104bb3848 _ZN3huiL19_hui_signal_handlerEi + 28

35 libsystem_platform.dylib 0x000000018b210184 _sigtramp + 56

36 ??? 0x0000000124e4037c 0x0 + 4913890172

37 ??? 0x0000000124e40d44 0x0 + 4913892676

38 tsunami 0x0000000104e882b8 _ZN7tsunami11Synthesizer18get_pitch_rendererEi + 224

39 tsunami 0x0000000104e88584 _ZN7tsunami11Synthesizer13_handle_eventERKNS_9MidiEventE + 40

40 tsunami 0x0000000104e88834 _ZN7tsunami11Synthesizer6renderERNS_11AudioBufferE + 564

41 tsunami 0x0000000104e87c28 _ZN7tsunami11Synthesizer10read_audioEiRNS_11AudioBufferE + 244

42 tsunami 0x0000000104e7e41c _ZN7tsunami7OutPort10read_audioERNS_11AudioBufferE + 48

43 tsunami 0x0000000104e80ee8 _ZN7tsunami11AudioOutput29_read_stream_into_ring_bufferEi + 132

44 tsunami 0x0000000104e818cc _ZN7tsunami11AudioOutput7commandENS_13ModuleCommandEx + 384

45 tsunami 0x0000000104e98f28 _ZN7tsunami11SignalChain7do_suckEv + 236

46 tsunami 0x0000000104e9949c _ZN7tsunami12SuckerThread6on_runEv + 60

47 tsunami 0x0000000104e59768 _ZL19__thread_start_funcPv + 68

48 libsystem_pthread.dylib 0x000000018b1db2e4 _pthread_start + 136

49 libsystem_pthread.dylib 0x000000018b1d60fc thread_start + 8

)

libc++abi: terminating due to uncaught exception of type NSException

zsh: abort ./build/tsunami

@ErinaceusLinnaeus ErinaceusLinnaeus changed the title Mandala plugin Mandala plugin - First-Trigger-Crash Nov 28, 2024
@momentarylapse
Copy link
Owner

hmmm, the interesting stuff seems to happen between point 38 and 35 of the stack trace. The SampleSynthesizer is receiving a midi event and tries to create a renderer for the associated pitch. The debugger is somewhat confused, since that happens inside kaba code. Then a memory fault happens, and all the rest just tries to signal/display the error.

I'm still puzzled by the exact location of the error. I pushed some debugging code for that area into the mandala-plugin branch. Could you try again?

@ErinaceusLinnaeus
Copy link
Author

Sorry...
After learning (a simple help command in the console helps to understand how to use this lldb) that lldb is actually waiting for a run and is not crashed trying to do something; here's the output for the first trigger crash:

Tsunami v2024.10-25-g6373be44 "absolute 2er0"

...don't worry. Everything will be fine!

audio library selected: portaudio

midi library selected: coremidi

2024-11-28 21:21:50.803477+0000 tsunami[22514:3157190] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x60000138a260> F8BB1C28-BAE8-11D6-9C31-00039315CD46

please note, that portaudio does not support refreshing the device list after program launch

2024-11-28 21:21:51.049904+0000 tsunami[22514:3157190] +[IMKClient subclass]: chose IMKClient_Modern

2024-11-28 21:21:55.681069+0000 tsunami[22514:3157190] [CursorUI] ViewBridge to RemoteViewService Terminated: Error Domain=com.apple.ViewBridge Code=18 "(null)" UserInfo={com.apple.ViewBridge.error.hint=this process disconnected remote view controller -- benign unless unexpected, com.apple.ViewBridge.error.description=NSViewBridgeErrorCanceled}

compiling module: plugins/independent/live-performance/Mandala.kaba

capture midi start

new SampleRenderer(self=0x121d35000, pitch=-1

PitchRenderer.init

this=0x60000094d400

synth=0x121d35000

pitch=-1

SampleRenderer.init()

Process 22514 stopped

  • thread #34, stop reason = EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff8)

    frame #0: 0x00000001171e43a4

-> 0x1171e43a4: ldr x0, [x1]

0x1171e43a8: ldr x1, [sp, #0x50]

0x1171e43ac: str x0, [x1]

0x1171e43b0: ldr x0, [sp, #0x8]

Target 0: (tsunami) stopped.

@ErinaceusLinnaeus
Copy link
Author

ErinaceusLinnaeus commented Nov 28, 2024

And here´s the backtrace:

  • thread # 34, stop reason = EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff8)
    • frame # 0: 0x000000011a5c03a4
      frame # 1: 0x000000011a5c0e4c
      frame # 2: 0x00000001003b01c8 tsunamitsunami::Synthesizer::get_pitch_renderer(this=0x0000000151a1f400, pitch=-1) at Synthesizer.cpp:134:6 frame # 3: 0x00000001003b0494 tsunamitsunami::Synthesizer::_handle_event(this=0x0000000151a1f400, e=0x00006000004fda80) at Synthesizer.cpp:164:13
      frame # 4: 0x00000001003b0744 tsunamitsunami::Synthesizer::render(this=0x0000000151a1f400, buf=0x00000001703fecc8) at Synthesizer.cpp:189:5 frame # 5: 0x00000001003afb38 tsunamitsunami::Synthesizer::read_audio(this=0x0000000151a1f400, port=0, buf=0x00000001703fecc8) at Synthesizer.cpp:68:2
      frame # 6: 0x00000001003a610c tsunamitsunami::OutPort::read_audio(this=0x0000000151a1f680, buf=0x00000001703fecc8) at Port.cpp:40:17 frame # 7: 0x00000001003a8bd8 tsunamitsunami::AudioOutput::_read_stream_into_ring_buffer(this=0x0000000151ed0800, buffer_size=2048) at AudioOutput.cpp:161:20
      frame # 8: 0x00000001003a95bc tsunamitsunami::AudioOutput::command(this=0x0000000151ed0800, cmd=Suck, param=2048) at AudioOutput.cpp:310:17 frame # 9: 0x00000001003c0e38 tsunamitsunami::SignalChain::do_suck(this=0x0000000151ee0c00) at SignalChain.cpp:569:19
      frame # 10: 0x00000001003c13ac tsunamitsunami::SuckerThread::on_run(this=0x0000600003673d40) at SignalChain.cpp:49:20 frame # 11: 0x0000000100381458 tsunami__thread_start_func(p=0x0000600003673d40) at Thread.cpp:165:5
      frame # 12: 0x000000018b1db2e4 libsystem_pthread.dylib`_pthread_start + 136

@momentarylapse
Copy link
Owner

ok, solved. The clue was the ..., pitch=-1) in the backtrace.

In the past, only note-on/off events were read from midi devices. Recently we enabled reading for ALL midi events (preparing for special events from the Mandala). But seems I forgot to update all the relevant code, and the synthesizers got confused about midi notes with pitch -1...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants