I noticed a crash report. This is not reproducible in my environment. The report mentions that as a port leak. How to detect and prevent such port leaks?
Extracts from the crash report:
OS Version: Mac OS X 10.15.7 (19H2)
...
Crashed Thread: 8
Exception Type: EXCBADINSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXCCORPSENOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [156]
Application Specific Information:
BUG IN CLIENT OF LIBDISPATCH: Unable to allocate reply port, possible port leak
Thread 8 Crashed:
0 libdispatch.dylib 0x00007fff68cfdf75 dispatchmachsendandwaitforreply.cold.6 + 29
1 libdispatch.dylib 0x00007fff68ce4cf4 dispatchmachsendandwaitforreply + 1630
2 libdispatch.dylib 0x00007fff68ce4d4e dispatchmachsendwithresultandwaitforreply + 50
3 libxpc.dylib 0x00007fff68f6c846 xpcconnectionsendmessagewithreplysync + 238
4 com.apple.CoreFoundation 0x00007fff2ecac083 _78-[CFPrefsPlistSource sendRequestNewDataMessage:toConnection:retryCount:error:]blockinvoke + 22
5 com.apple.CoreFoundation 0x00007fff2ecb3779 CFPREFERENCESISWAITINGFORSYSTEMCFPREFSD + 74
6 com.apple.CoreFoundation 0x00007fff2ecabfdf -[CFPrefsPlistSource sendRequestNewDataMessage:toConnection:retryCount:error:] + 672
7 com.apple.CoreFoundation 0x00007fff2ecabd0e _50-[CFPrefsPlistSource alreadylockedrequestNewData]blockinvoke + 197
8 com.apple.CoreFoundation 0x00007fff2ec6d726 -[CFXPreferences withConnectionForRole:performBlock:] + 36
9 com.apple.CoreFoundation 0x00007fff2ecabbee -[CFPrefsPlistSource alreadylockedrequestNewData] + 332
10 com.apple.CoreFoundation 0x00007fff2ec916a4 copyValueForKey + 193
11 com.apple.CoreFoundation 0x00007fff2ec915c7 -[CFPrefsPlistSource copyValueForKey:] + 45
12 com.apple.CoreFoundation 0x00007fff2ec91587 66-[CFXPreferences copyValueForKey:identifier:user:host:container:]blockinvoke + 32
13 com.apple.CoreFoundation 0x00007fff2ec697d7 -[CFXPreferences(SourceAdditions) withSourceForIdentifier:user:byHost:container:cloud:perform:] + 795
14 com.apple.CoreFoundation 0x00007fff2ec914ef -[CFXPreferences copyValueForKey:identifier:user:host:container:] + 184
15 com.apple.CoreFoundation 0x00007fff2ec913f5 _CFPreferencesCopyValueWithContainer + 113
...
Extracts from the crash report:
OS Version: Mac OS X 10.15.7 (19H2)
...
Crashed Thread: 8
Exception Type: EXCBADINSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXCCORPSENOTIFY
Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [156]
Application Specific Information:
BUG IN CLIENT OF LIBDISPATCH: Unable to allocate reply port, possible port leak
Thread 8 Crashed:
0 libdispatch.dylib 0x00007fff68cfdf75 dispatchmachsendandwaitforreply.cold.6 + 29
1 libdispatch.dylib 0x00007fff68ce4cf4 dispatchmachsendandwaitforreply + 1630
2 libdispatch.dylib 0x00007fff68ce4d4e dispatchmachsendwithresultandwaitforreply + 50
3 libxpc.dylib 0x00007fff68f6c846 xpcconnectionsendmessagewithreplysync + 238
4 com.apple.CoreFoundation 0x00007fff2ecac083 _78-[CFPrefsPlistSource sendRequestNewDataMessage:toConnection:retryCount:error:]blockinvoke + 22
5 com.apple.CoreFoundation 0x00007fff2ecb3779 CFPREFERENCESISWAITINGFORSYSTEMCFPREFSD + 74
6 com.apple.CoreFoundation 0x00007fff2ecabfdf -[CFPrefsPlistSource sendRequestNewDataMessage:toConnection:retryCount:error:] + 672
7 com.apple.CoreFoundation 0x00007fff2ecabd0e _50-[CFPrefsPlistSource alreadylockedrequestNewData]blockinvoke + 197
8 com.apple.CoreFoundation 0x00007fff2ec6d726 -[CFXPreferences withConnectionForRole:performBlock:] + 36
9 com.apple.CoreFoundation 0x00007fff2ecabbee -[CFPrefsPlistSource alreadylockedrequestNewData] + 332
10 com.apple.CoreFoundation 0x00007fff2ec916a4 copyValueForKey + 193
11 com.apple.CoreFoundation 0x00007fff2ec915c7 -[CFPrefsPlistSource copyValueForKey:] + 45
12 com.apple.CoreFoundation 0x00007fff2ec91587 66-[CFXPreferences copyValueForKey:identifier:user:host:container:]blockinvoke + 32
13 com.apple.CoreFoundation 0x00007fff2ec697d7 -[CFXPreferences(SourceAdditions) withSourceForIdentifier:user:byHost:container:cloud:perform:] + 795
14 com.apple.CoreFoundation 0x00007fff2ec914ef -[CFXPreferences copyValueForKey:identifier:user:host:container:] + 184
15 com.apple.CoreFoundation 0x00007fff2ec913f5 _CFPreferencesCopyValueWithContainer + 113
...