A while after updating to macOS 12 (Monterey) scsynth fails to start

Any idea why this could happen?

./scsynth -u 57110
SC_AudioDriver: sample rate = 48000.000000, driver's block size = 512
PublishPortToRendezvous 0 5855
SuperCollider 3 server ready.
2022-05-31 10:31:04.668 scsynth[828:8585] ApplePersistence=YES
Segmentation fault: 11

This is both with the downloaded version and the one I compiled myself.

A bit more info with dtruss:

 1431/0x6fb4:  workq_kernreturn(0x100, 0x700004F41B80, 0x1)		 = 0 -2
 1431/0x7003:  fcntl(0x8, 0x2, 0x1)		 = 0 0
 1431/0x7003:  fcntl(0x9, 0x2, 0x1)		 = 0 0
 1431/0x7003:  ioctl(0x8, 0x8004667E, 0x700005565230)		 = 0 0
 1431/0x7003:  ioctl(0x9, 0x8004667E, 0x700005565230)		 = 0 0
 1431/0x7003:  getrlimit(0x1008, 0x700005565180, 0x0)		 = 0 0
dtrace: error on enabled probe ID 1729 (ID 573: syscall::sysctl:return): invalid kernel access in action #11 at DIF offset 28
 1431/0x7003:  setrlimit(0x1008, 0x700005565150, 0x0)		 = 0 0
 1431/0x7003:  getsockopt(0x7, 0xFFFF, 0x1008)		 = 0 0
 1431/0x7003:  bsdthread_create(0x7FF814D993B8, 0x0, 0x70000566C000)		 = 90619904 0
 1431/0x7005:  thread_selfid(0x0, 0x0, 0x0)		 = 28677 0
 1431/0x7005:  proc_info(0x5, 0x597, 0x2)		 = 0 0
 1431/0x7003:  sendto(0x8, 0x70000556511E, 0x1)		 = 1 0
 1431/0x7003:  psynch_mutexdrop(0x7FF856264910, 0x100, 0x100)		 = 0 0
 1431/0x7005:  psynch_mutexwait(0x7FF856264910, 0x102, 0x0)		 = 259 0
 1431/0x7005:  select(0x20, 0x600001A10A60, 0x600001A10A30, 0x0, 0x0)		 = 1 0
 1431/0x7005:  recvfrom(0x9, 0x70000566BBD0, 0x100)		 = 1 0
 1431/0x6fb3:  issetugid(0x0, 0x0, 0x0)		 = 0 0
 1431/0x6fb3:  kevent_id(0x60000360EA80, 0x7FF7B6E9E5E8, 0x1)		 = 0 0
 1431/0x6fb4:  workq_kernreturn(0x100, 0x700004F41B80, 0x1)		 = 0 -2
 1431/0x6fb3:  kevent_id(0x600003618080, 0x7FF7B6E9EC28, 0x1)		 = 0 0
 1431/0x6fb4:  workq_kernreturn(0x100, 0x700004F41B80, 0x1)		 = 0 -2
 1431/0x6fb3:  mprotect(0x109188000, 0x100000, 0x3)		 = 0 0
 1431/0x6fb3:  mprotect(0x109188000, 0x100000, 0x1)		 = 0 0
 1431/0x6fb3:  mprotect(0x109188000, 0x100000, 0x3)		 = 0 0
 1431/0x6fb3:  mprotect(0x109188000, 0x100000, 0x1)		 = 0 0
 1431/0x6fc4:  workq_kernreturn(0x100, 0x700005047B80, 0x1)		 = 0 -2
 1431/0x6fc5:  __semwait_signal(0x903, 0x0, 0x1)		 = -1 4
 1431/0x6fb4:  workq_kernreturn(0x100, 0x700004F41B80, 0x1)		 = 0 -2
 1431/0x6fb5:  workq_kernreturn(0x100, 0x700004FC4B80, 0x1)		 = 0 -2
 1431/0x6fc6:  psynch_cvwait(0x7FA1E18F5800, 0x100000100, 0x0)		 = -1 260
 1431/0x7002:  kevent(0x3, 0x0, 0x0)		 = -1 4
 1431/0x7005:  select(0x20, 0x600001A10A60, 0x600001A10A30, 0x0, 0x0)		 = -1 4

I have no problem launching scsynth in a terminal window, but my machine is an M1 machine preinstalled with macOS 12.

On my end, executing the same code, you did,

prko@MBP2021 Resources % ./scsynth -u 57110

returns the following result:

Found 0 LADSPA plugins
Number of Devices: 10
0 : “LG TV”
1 : “CalDigit Thunderbolt 3 Audio”
2 : “CalDigit Thunderbolt 3 Audio”
3 : “MacBook Pro Microphone”
4 : “MacBook Pro Speakers”
5 : “Parallels Access Sound”
6 : “Parallels Access Sound”
7 : “ZoomAudioD”
8 : “Aggregate Device”
9 : “Multi-Output Device”

“MacBook Pro Microphone” Input Device
Streams: 1
0 channels 1

“MacBook Pro Speakers” Output Device
Streams: 1
0 channels 2

SC_AudioDriver: sample rate = 48000.000000, driver’s block size = 512
PublishPortToRendezvous 0 5855
SuperCollider 3 server ready.

I was also able to run SC after updating to Monterey (previously on Big Sur, M1 hardware), not sure what the problem is…

I’d try removing SC “microphone input” permissions in the security System Preferences, then re-running SC.

Also, does this happen when you start SC from the IDE?

How long does scsynth “survive”?
Maybe this is caused by a faulty extension or dependency? Maybe purging the extensions folder could help as the installations share them globally AFAIK which easily can lead to confusing situations.

Some things that may can give a hint:

edit: also consider checking brew doctor

1 Like

@MarcinP, good idea with the mic input, but this didn’t change anything. I get asked for permission and when I grant it, the server tries to start but crashes immediately.

Yes, this is also from the IDE.

(I don’t have M1)

@dscheiba

How long does scsynth “survive”?

it immediately crashes on boot, also with extensions switched off and all old synthdefs deleted.

edit: also consider checking brew doctor

yes, lots of stuff to do there. But: it also happend with the downloaded binary.

I’ll check the other traces tomorrow… thatnks!

the log is rather too large – what part is useful for diagnosis?

Filter for e.g. scsynth and go from there

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               scsynth [2416]
Path:                  /Volumes/VOLUME/*/SuperCollider.app/Contents/Resources/../Resources/scsynth
Identifier:            scsynth
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        sclang [1396]
Responsible:           SuperCollider [1392]
User ID:               501

Date/Time:             2022-05-31 12:23:14.7827 +0200
OS Version:            macOS 12.4 (21F79)
Report Version:        12
Bridge OS Version:     6.5 (19P5071)
Anonymous UUID:        F331CE8A-2782-A6F9-3388-06BFAB46D7F9

Sleep/Wake UUID:       006A0B67-26BB-4052-88A1-331D1A72162D

Time Awake Since Boot: 6500 seconds
Time Since Wake:       4864 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 0x0000000000000000
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [2416]

VM Region Info: 0 is not in any region.  Bytes before following region: 4296589312
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      10018c000-100200000    [  464K] r-x/r-x SM=COW  ...urces/scsynth

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libdispatch.dylib             	    0x7ff814af358b dispatch_release + 4
1   AppKit                        	    0x7ff8181e77ed -[NSPersistentUIManager dealloc] + 37
2   AppKit                        	    0x7ff8177b2d14 -[NSPersistentUIManager initWithBundleID:] + 384
3   Foundation                    	    0x7ff815b7ed03 _NSFaultInObject + 30
4   HIToolbox                     	    0x7ff81da17c92 _HIPersistentUIBeginAcquiringExternallyCreatedWindows + 43
5   HIToolbox                     	    0x7ff81da1767e _FirstEventTime + 50
6   HIToolbox                     	    0x7ff81da174f3 RunCurrentEventLoopInMode + 49
7   HIToolbox                     	    0x7ff81da17213 ReceiveNextEventCommon + 283
8   HIToolbox                     	    0x7ff81da170e5 _BlockUntilNextEventMatchingListInModeWithFilter + 70
9   AppKit                        	    0x7ff8177af1fd _DPSNextEvent + 927
10  AppKit                        	    0x7ff8177ad8ba -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1394
11  scsynth                       	       0x100193aa1 SC::Apple::EventLoop::run() + 241 (SC_AppleEventLoop.mm:52)
12  scsynth                       	       0x100193198 EventLoop::run(std::__1::function<void ()>) + 136 (SC_EventLoop.hpp:36)
13  scsynth                       	       0x100191573 scsynth_main(int, char**) + 2227 (scsynth_main.cpp:460)
14  dyld                          	       0x103f0651e start + 462

Thread 1:
0   libsystem_pthread.dylib       	    0x7ff814ca6f48 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib       	    0x7ff814ca6f48 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib       	    0x7ff814ca6f48 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib       	    0x7ff814ca6f48 start_wqthread + 0

Thread 5:
0   libsystem_kernel.dylib        	    0x7ff814c712be __semwait_signal + 10
1   libsystem_c.dylib             	    0x7ff814b85863 nanosleep + 196
2   libc++.1.dylib                	    0x7ff814c13ab1 std::__1::this_thread::sleep_for(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > const&) + 73
3   UIUGens.scx                   	       0x103c0f1b4 void std::__1::this_thread::sleep_for<long long, std::__1::ratio<1l, 1000l> >(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000l> > const&) + 16 (thread:386) [inlined]

<snip>

Thread 13:
0   libsystem_kernel.dylib        	    0x7ff814c7334e kevent + 10
1   scsynth                       	       0x100196a10 boost::asio::detail::kqueue_reactor::run(long, boost::asio::detail::op_queue<boost::asio::detail::scheduler_operation>&) + 288
2   scsynth                       	       0x100196555 boost::asio::detail::scheduler::do_run_one(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost::asio::detail::scheduler_thread_info&, boost::system::error_code const&) + 293
3   scsynth                       	       0x100196171 boost::asio::detail::scheduler::run(boost::system::error_code&) + 225
4   scsynth                       	       0x100193e62 scsynth::asioFunction() + 98
5   scsynth                       	       0x10019f4a8 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)()> >(void*) + 40
6   libsystem_pthread.dylib       	    0x7ff814cab4e1 _pthread_start + 125
7   libsystem_pthread.dylib       	    0x7ff814ca6f6b thread_start + 15

Thread 14:
0   libsystem_kernel.dylib        	    0x7ff814c6e9b6 semaphore_wait_trap + 10
1   libdispatch.dylib             	    0x7ff814af47ce _dispatch_sema4_wait + 16
2   libdispatch.dylib             	    0x7ff814af4c9d _dispatch_semaphore_wait_slow + 98
3   scsynth                       	       0x1001d1876 World_WaitForQuit + 38
4   scsynth                       	       0x1001937a3 std::__1::__function::__value_func<void ()>::operator()() const + 15 (function.h:505) [inlined]
5   scsynth                       	       0x1001937a3 std::__1::function<void ()>::operator()() const + 15 (function.h:1182) [inlined]
6   scsynth                       	       0x1001937a3 EventLoop::run(std::__1::function<void ()>)::'lambda'()::operator()() const + 15 (SC_EventLoop.hpp:31) [inlined]
7   scsynth                       	       0x1001937a3 decltype(static_cast<EventLoop::run(std::__1::function<void ()>)::'lambda'()>(fp)()) std::__1::__invoke<EventLoop::run(std::__1::function<void ()>)::'lambda'()>(EventLoop::run(std::__1::function<void ()>)::'lambda'()&&) + 15 (type_traits:3918) [inlined]
8   scsynth                       	       0x1001937a3 void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, EventLoop::run(std::__1::function<void ()>)::'lambda'()>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, EventLoop::run(std::__1::function<void ()>)::'lambda'()>&, std::__1::__tuple_indices<>) + 15 (thread:287) [inlined]
9   scsynth                       	       0x1001937a3 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, EventLoop::run(std::__1::function<void ()>)::'lambda'()> >(void*) + 51 (thread:298)
10  libsystem_pthread.dylib       	    0x7ff814cab4e1 _pthread_start + 125
11  libsystem_pthread.dylib       	    0x7ff814ca6f6b thread_start + 15

*** EDITED ***

The log above is very useful, as it tells us that the crash happens in the Cocao event loop.

Actually, other people had very same crash with other applications:
Crash when creating window on High Sierra · Issue #1188 · glfw/glfw · GitHub.
Export Plugins crashes jpg/png on Mac OS if ApplePersistence=YES (#3626) · Issues · GNOME / GIMP · GitLab

Seems like the problem is caused by the ApplePersistence setting. AFAICT, this enables auto-saving. You probably have enabled this globally, which can cause issues with some apps. Just try to disable it (see the issues above for instructions).

2 Likes

Yes, that was it. Perfect (really obscure bug).

For anyone else running into this:

defaults delete -g ApplePersistence

I’ve always had problems with autosave, I hope this might improve it, too.

1 Like