Crash:Exceeded system-wide per-process Port Limit

Hi everyone,

I’m encountering a crash in my app and need help understanding what’s causing it and how to resolve it.

As stated in the crash report, the issue is caused by exceeding the system-wide per-process port limit. Can you tell me how to locate and identify why this is happening?

Below are the full report of the crash log:

Summary of Crash:
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Incident Identifier: B509FF2B-C8D8-4E9F-B664-E24464CFD5F8
CrashReporter Key: b390cfe931a83efde49bd8b523023a275b55ef64
Hardware Model: iPhone14,2
Process: MyApp [22515]
Path: /private/var/containers/Bundle/Application/F73212A7-4CB9-485A-A8B7-8114F4E9A9AB/MyApp.app/MyApp
Identifier: com.beeasy.app.id.enterprise
Version: 3.41.38-ID-MySDKMemory-12261114 (3.41.38-ID-MySDKMemory-12261114)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.beeasy.app.id.enterprise [515]
Date/Time: 2024-12-29 01:29:48.3023 +0800
Launch Time: 2024-12-26 16:38:36.7895 +0800
OS Version: iPhone OS 16.6.1 (20G81)
Release Type: User
Baseband Version: 2.80.01
Report Version: 104
Exception Type: EXC_RESOURCE (SIGKILL)
Exception Codes: 0x000000000001c1d6, 0x0000000000000000
Termination Reason: PORT_SPACE 14123288431433990614 (Limit 115158 ports) Exceeded system-wide per-process Port Limit
Triggered by Thread: 64
Thread 64 name: AURemoteIO::IOThread
Thread 64 Crashed:
0 libsystem_kernel.dylib 0x20ce5eca4 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x20ce71b74 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x20ce71e4c mach_msg_overwrite + 540
3 libsystem_kernel.dylib 0x20ce5f1e8 mach_msg + 24
4 libEmbeddedSystemAUs.dylib 0x238bb2148 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, AURemoteIO::IOThread::IOThread(AURemoteIO&, caulk::thread::attributes const&, caulk::mach::os_workgroup_managed const&)::'lambda'(), std::__1::tuple<>>>(void*) + 556
5 libsystem_pthread.dylib 0x22dcda6b8 _pthread_start + 148
6 libsystem_pthread.dylib 0x22dcd9b88 thread_start + 8

The report suggests that it may be because the app is creating an enormous number of threads.

Thank you for sharing the post and the crash file in a readable format. This is a very interesting crash, some threads look exactly like other thread and they finish with the wait commend.

I concur with @endecotp assessment that it appears as though you are awaiting the unlocking of a thread. If you have completed using the thread, kindly allow it to return so that it can be cleaned up. It seems that you are locking multiple threads after their usage, which may be causing resource issue you are seeing.

To identify potential deadlocks, I recommend inspecting your application thread management.

However, additional information about the application would be beneficial. Additionally, Instruments can provide valuable insights into the resources utilized by the application.

Very interested to know the resolution of this crash personally.

Albert Pascual
  Worldwide Developer Relations.

I have a similar issue, it refers to my Thread 3 which is com.apple.SwiftUI.AsyncRenderer which could be something to do with animation?? (CA::Context::commit_transaction(CA::Transaction*, double, double*) + 13596) I have edited out the following two lines of code and will monitor for a few days for repeat crashes.

.rotationEffect(.degrees(rotate ? 0 : 360)) .animation(.linear(duration: 40).repeatForever(autoreverses: false), value: rotate)

Here's the Thread three stack:

Thread 3 name: com.apple.SwiftUI.AsyncRenderer Thread 3 Crashed: 0 libsystem_kernel.dylib 0x1e274162c _kernelrpc_mach_port_allocate_trap + 8 1 libsystem_kernel.dylib 0x1e2748478 mach_port_allocate + 36 2 QuartzCore 0x192d4552c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 13596 3 QuartzCore 0x192cb8d58 CA::Transaction::commit() + 648 4 QuartzCore 0x192cb8764 CA::Transaction::flush_as_runloop_observer(bool) + 88 5 CoreFoundation 0x19119f894 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 36 6 CoreFoundation 0x19119f3e8 __CFRunLoopDoObservers + 552 7 CoreFoundation 0x1912462c0 CFRunLoopRunSpecific + 664 8 Foundation 0x18fdc8338 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 9 Foundation 0x18fdc4500 -[NSRunLoop(NSRunLoop) run] + 64 10 SwiftUI 0x195c276d8 specialized static DisplayLink.asyncThread(arg:) + 792 11 SwiftUI 0x195c273a8 @objc static DisplayLink.asyncThread(arg:) + 72 12 Foundation 0x18feb4194 NSThread__start + 724 13 libsystem_pthread.dylib 0x21bcfb7d0 _pthread_start + 136 14 libsystem_pthread.dylib 0x21bcfb480 thread_start + 8

Crash:Exceeded system-wide per-process Port Limit
 
 
Q