Webview-based CHOC Plugin Regularly Crashing DAW

Hi all,

I’m having an issue I just can’t seem to pin down. I’m creating a webview based plugin that uses the juce::NSViewComponent/juce::HWNDComponent for the GUI using GitHub - Tracktion/choc: A collection of header only classes, permissively licensed, to provide basic useful tasks with the bare-minimum of dependencies. for interop communication. I am getting what feels to be super random crashes related to the NSEventThread using a juce::NSViewComponent on Mac. I haven’t tested this plugin on Windows yet so I can’t comment on the juce::HWNDComponent. Sometimes the crashes won’t happen for days and since I can’t easily cause the crash, the stack trace isn’t very helpful in pinning down what might be happening. I’m wondering if anyone might have some insight into what may be going on here. I can provide any C++ code that might be helpful. Here is what a standard crash report related to this issue looks like:

Time Awake Since Boot: 23000 seconds
Time Since Wake:       22246 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000100000008
Exception Codes:       0x0000000000000001, 0x0000000100000008

VM Region Info: 0x100000008 is not in any region.  Bytes before following region: 71696376
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      104460000-105a9c000    [ 22.2M] r-x/r-x SM=COW  ...OS/Studio One

Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   WebKit                        	       0x1a6613330 WebKit::ProcessThrottlerActivity::invalidate() + 44
1   WebKit                        	       0x1a6612ed8 WebKit::ProcessThrottler::invalidateAllActivities() + 364
2   WebKit                        	       0x1a6612cdc WebKit::ProcessThrottler::~ProcessThrottler() + 24
3   WebKit                        	       0x1a605698c WebKit::WebProcessProxy::~WebProcessProxy() + 916
4   WebKit                        	       0x1a60565e0 WebKit::WebProcessProxy::~WebProcessProxy() + 16
5   WebKit                        	       0x1a61dccf4 WTF::ThreadSafeRefCounted<WebKit::AuxiliaryProcessProxy, (WTF::DestructionThread)2>::deref() const + 108
6   WebKit                        	       0x1a66a41b8 WTF::Detail::CallableWrapper<WebKit::WebPageProxy::close()::$_16, void>::~CallableWrapper() + 84
7   JavaScriptCore                	       0x19f41bd60 WTF::RunLoop::performWork() + 244
8   JavaScriptCore                	       0x19f41cc08 WTF::RunLoop::performWork(void*) + 36
9   CoreFoundation                	       0x1836e9cfc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
10  CoreFoundation                	       0x1836e9c90 __CFRunLoopDoSource0 + 176
11  CoreFoundation                	       0x1836e9a00 __CFRunLoopDoSources0 + 244
12  CoreFoundation                	       0x1836e85f0 __CFRunLoopRun + 828
13  CoreFoundation                	       0x1836e7c5c CFRunLoopRunSpecific + 608
14  HIToolbox                     	       0x18dc64448 RunCurrentEventLoopInMode + 292
15  HIToolbox                     	       0x18dc640d8 ReceiveNextEventCommon + 220
16  HIToolbox                     	       0x18dc63fdc _BlockUntilNextEventMatchingListInModeWithFilter + 76
17  AppKit                        	       0x186ec2c54 _DPSNextEvent + 660
18  AppKit                        	       0x187698ebc -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
19  AppKit                        	       0x186eb6100 -[NSApplication run] + 476
20  Foundation                    	       0x1847e0494 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 848
21  Foundation                    	       0x1847dff9c -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 112
22  cclgui                        	       0x109a67414 0x10974c000 + 3257364
23  Studio One                    	       0x10459ed08 0x104460000 + 1305864
24  Studio One                    	       0x10459f598 0x104460000 + 1308056
25  dyld                          	       0x1832910e0 start + 2360

Thread 1:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	       0x1835cc8b4 mach_msg2_trap + 8
1   libsystem_kernel.dylib        	       0x1835ded30 mach_msg2_internal + 80
2   libsystem_kernel.dylib        	       0x1835d54f0 mach_msg_overwrite + 476
3   libsystem_kernel.dylib        	       0x1835ccc38 mach_msg + 24
4   CoreFoundation                	       0x1836e9ea4 __CFRunLoopServiceMachPort + 160
5   CoreFoundation                	       0x1836e876c __CFRunLoopRun + 1208
6   CoreFoundation                	       0x1836e7c5c CFRunLoopRunSpecific + 608
7   AppKit                        	       0x186fec404 _NSEventThread + 144
8   libsystem_pthread.dylib       	       0x18360d034 _pthread_start + 136
9   libsystem_pthread.dylib       	       0x183607e3c thread_start + 8

Thread 2:: ThreadPool
0   libsystem_kernel.dylib        	       0x1835d00ac __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x18360d5fc _pthread_cond_wait + 1228
2   cclsystem                     	       0x10682a594 0x106754000 + 877972
3   cclsystem                     	       0x1067e6544 0x106754000 + 599364
4   cclsystem                     	       0x1067e7eac 0x106754000 + 605868
5   cclsystem                     	       0x1067e7e44 0x106754000 + 605764
6   cclsystem                     	       0x1067e56a0 0x106754000 + 595616
7   cclsystem                     	       0x106829310 0x106754000 + 873232
8   libsystem_pthread.dylib       	       0x18360d034 _pthread_start + 136
9   libsystem_pthread.dylib       	       0x183607e3c thread_start + 8

Thank you in advance!

I’m not sure this is the correct forum for choc based queries. Perhaps you can try the Audio Programmer’s discord server?, it has a choc sub-forum. Or perhaps file an issue on the choc github tracker?

Hi Rory,

Thanks for your response. I don’t think this crash is related to Choc specifically (but I don’t know for sure). I’m just trying to give context. My instantiation of Choc is as simple as can be and I sometimes get crashes on the “AudioMixThread” which seems completely unrelated to Choc. Does anyone know what the AudioMixThread is? A google search returns zero results.