falkTX / Carla

Audio plugin host
https://kx.studio/carla
1.58k stars 145 forks source link

Carla 2.5.x crashes when scanning AU plugins #1685

Open Rhys-T opened 1 year ago

Rhys-T commented 1 year ago

Whenever I try to scan for AudioUnit plugins in Carla 2.5.0 through 2.5.2, it crashes, with a log mentioning a "Pure virtual function called!" error. 2.4.3 has no problem scanning them. Removing third-party AUs has no effect - it basically always crashes when scanning even the system's builtin plugins, unless I uncheck 'AU'.

It looks like a very similar crash to #1101 (__cxa_pure_virtual while scanning AUs), but I'm not using Carla's API - I'm just running the standalone app version, and clicking Add Plugin > Refresh > Scan. Every once in a while, it 'randomly' decides to work… once. Running a nested instance of Carla (as a plugin, or as a Cardinal module) also has the same issue, though it only crashes the carla-plugin-patchbay subprocess.

What appears to be the main backtrace: (can upload the rest of the log if needed) ``` Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Application Specific Information: abort() called Pure virtual function called! Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff6e47432a __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff6e530e60 pthread_kill + 430 2 libsystem_c.dylib 0x00007fff6e3fb808 abort + 120 3 libc++abi.dylib 0x00007fff6b658458 abort_message + 231 4 libc++abi.dylib 0x00007fff6b657e92 __cxa_pure_virtual + 18 5 com.apple.CoreFoundation 0x00007fff346c2a19 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 6 com.apple.CoreFoundation 0x00007fff346c257f __CFRunLoopDoTimer + 859 7 com.apple.CoreFoundation 0x00007fff346c2067 __CFRunLoopDoTimers + 322 8 com.apple.CoreFoundation 0x00007fff346a6e2a __CFRunLoopRun + 1871 9 com.apple.CoreFoundation 0x00007fff346a607e CFRunLoopRunSpecific + 462 10 com.apple.HIToolbox 0x00007fff332d2aad RunCurrentEventLoopInMode + 292 11 com.apple.HIToolbox 0x00007fff332d27c5 ReceiveNextEventCommon + 584 12 com.apple.HIToolbox 0x00007fff332d2569 _BlockUntilNextEventMatchingListInModeWithFilter + 64 13 com.apple.AppKit 0x00007fff3191b3c9 _DPSNextEvent + 883 14 com.apple.AppKit 0x00007fff31919c10 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352 15 com.apple.AppKit 0x00007fff3190b91e -[NSApplication run] + 658 16 libqcocoa.dylib 0x000000011275d3c8 0x11272d000 + 197576 17 QtCore 0x000000010ed24000 QEventLoop::exec(QFlags) + 322 18 QtWidgets 0x0000000111d410a2 QDialog::exec() + 274 19 QtWidgets.so 0x00000001118584f4 meth_QDialog_exec_(_object*, _object*) + 164 ```
Backtrace of the `SearchPluginsThread`: ``` Thread 14:: SearchPluginsThread 0 com.apple.audio.units.Components 0x0000000127dcb381 0x127dbd000 + 58241 1 com.apple.audio.units.Components 0x0000000127ebddd3 0x127dbd000 + 1052115 2 com.apple.audio.units.Components 0x0000000127ec1422 0x127dbd000 + 1066018 3 com.apple.audio.AudioToolboxCore 0x00007fff491cfbef AudioComponentInstanceDispose + 58 4 libcarla_utils.dylib 0x0000000115d56964 0x115d0e000 + 297316 ```
Rhys-T commented 1 year ago

Okay, I tried moving all of Carla's preferences and caches that I could find aside[^1], to simulate a fresh install (should have tried this sooner), and Carla 2.5.2 could scan everything just fine… then I started moving things back[^1], and it kept working. So I can no longer reproduce this. Something must have gotten confused when I switched to the newer version.

~This can be closed now, since the problem I was having seems to be resolved, or I can leave it open if the underlying problem still needs to be tracked down.~

Edit 2/25/2023: Just started happening again on 2.5.3. Once again, moving all the prefs files aside and flushing them from cfprefsd made it start working, and moving them back and flushing again didn't re-break it. Very odd.

[^1]: And defaults read-ing each preferences domain after moving the files, to flush any in-memory caches that cfprefsd might have had for them.

Rhys-T commented 1 year ago

It seems to start happening when I change the list of plugin directories. And I just had it get worse, where putting all the files back actually did make it start crashing again. I've put just com.falktx.Carla2.plist back this time and let it regenerate the rest, and it seems to be working fine now.