NEPacketTunnelFlow crash in dispatch queue

I am seeing a random crash in the NEPacketTunnelFlow dispatch queue after several minutes to several hours of running traffic thru the PTP and I was hoping someone could point me in the right direction as to what is happening.

Attached is the full crash report but here is a snippet:


[crash.txt](https://developer.apple.com/forums/content/attachment/735f7f48-7129-4521-befa-87ac88322e98)
Process:               com.cradlepoint.netcloud.agent.extension [63907]
Path:                  /Library/SystemExtensions/*/com.cradlepoint.netcloud.agent.extension
Identifier:            com.cradlepoint.netcloud.agent.extension
Version:               1.100 (1)
Code Type:             X86-64 (Native)
Parent Process:        launchd [1]
User ID:               0

Date/Time:             2023-05-13 17:20:16.4626 -0600
OS Version:            macOS 13.3.1 (22E772610a)
Report Version:        12
Bridge OS Version:     7.4 (20P4252)
Anonymous UUID:        27D22D69-B050-5484-7F51-A2ABFD60C2E2

Sleep/Wake UUID:       B3C27F8E-10DB-4AF9-B02B-A506571814F6

Time Awake Since Boot: 240000 seconds
Time Since Wake:       131510 seconds

System Integrity Protection: disabled

Crashed Thread:        13  Dispatch queue: NEPacketTunnelFlow queue

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
abort() called

Thread 13 Crashed::  Dispatch queue: NEPacketTunnelFlow queue
0   libsystem_kernel.dylib        	    0x7ff80ddf71f2 __pthread_kill + 10
1   libsystem_pthread.dylib       	    0x7ff80de2eee6 pthread_kill + 263
2   libsystem_c.dylib             	    0x7ff80dd55b45 abort + 123
3   libc++abi.dylib               	    0x7ff80dde9282 abort_message + 241
4   libc++abi.dylib               	    0x7ff80dddb3e1 demangling_terminate_handler() + 241
5   libobjc.A.dylib               	    0x7ff80daaf7d6 _objc_terminate() + 104
6   libc++abi.dylib               	    0x7ff80dde86db std::__terminate(void (*)()) + 6
7   libc++abi.dylib               	    0x7ff80dde8696 std::terminate() + 54
8   libdispatch.dylib             	    0x7ff80dc8e047 _dispatch_client_callout + 28
9   libdispatch.dylib             	    0x7ff80dc90b65 _dispatch_continuation_pop + 463
10  libdispatch.dylib             	    0x7ff80dca27af _dispatch_source_invoke + 2184
11  libdispatch.dylib             	    0x7ff80dc94088 _dispatch_lane_serial_drain + 393
12  libdispatch.dylib             	    0x7ff80dc94d39 _dispatch_lane_invoke + 366
13  libdispatch.dylib             	    0x7ff80dc9f3fc _dispatch_workloop_worker_thread + 765
14  libsystem_pthread.dylib       	    0x7ff80de2bc55 _pthread_wqthread + 327
15  libsystem_pthread.dylib       	    0x7ff80de2abbf start_wqthread + 15

Attached is the full crash report …

I don’t see that. Please post a reply with the full crash report attached there. See Posting a Crash Report for more details.

here is a snippet

That suggests your process has crashed due to an unhandled language exception. In most cases such crash reports will include a Last Exception Background Backtrace section that’s key to determining what’s gone wrong.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Weird. I could have sworn I attached it. Try #2. I also don't see anything that indicates a "Last Exception Background"

Try #2.

Got it. Thanks.

I also don't see anything that indicates a "Last Exception Back…"

Yep. This is an annoying limitation of our crash reporting infrastructure. The Last Exception Backtrace section is only present for Objective-C exceptions. The crash reporter is unable to provide for this C++ exceptions )-: See this post, and its follow-ups, for the full backstory.

So, the only thing you have to go on is the crashing thread’s backtrace:

Thread 13 Crashed::  Dispatch queue: NEPacketTunnelFlow queue
0   libsystem_kernel.dylib  … __pthread_kill + 10
1   libsystem_pthread.dylib … pthread_kill + 263
2   libsystem_c.dylib       … abort + 123
3   libc++abi.dylib         … abort_message + 241
4   libc++abi.dylib         … demangling_terminate_handler() + 241
5   libobjc.A.dylib         … _objc_terminate() + 104
6   libc++abi.dylib         … std::__terminate(void (*)()) + 6
7   libc++abi.dylib         … std::terminate() + 54
8   libdispatch.dylib       … _dispatch_client_callout + 28
9   libdispatch.dylib       … _dispatch_continuation_pop + 463
10  libdispatch.dylib       … _dispatch_source_invoke + 2184
11  libdispatch.dylib       … _dispatch_lane_serial_drain + 393
12  libdispatch.dylib       … _dispatch_lane_invoke + 366
13  libdispatch.dylib       … _dispatch_workloop_worker_thread + 765
14  libsystem_pthread.dylib … _pthread_wqthread + 327
15  libsystem_pthread.dylib … start_wqthread + 15

Frames 15 through 8 are standard Dispatch stuff, namely, a Dispatch worker thread servicing a queue. Frames 7 through 0 are the C++ exception handler terminating the process because the C++ exception went unhandled. So far, so generic.

About the only useful thing is the thread name, NEPacketTunnelFlow queue. This suggests that the unhandled exception is coming from the C++ code that you run to handle the flow. I recommend that you add a catch-all exception handler to that code to ensure that it can’t throw C++ exception out to the system. So, where you have code like this:

[flow readPacketObjectsWithCompletionHandler:^(NSArray<NEPacket *> * _Nonnull packets) {
    … call C++ …
}];

make sure that you handle any C++ exceptions coming up from below.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Quinn,

Thanks that helps a lot.

NEPacketTunnelFlow crash in dispatch queue
 
 
Q