On rare occasions when changing network on a machine with network extension installed (e.g. when disconnecting laptop from Docking station and connecting to Wi-Fi), Network freezes, and a few seconds later machine crashes.
On console we can see that there was a crash in UserEventAgent:
And on system.log we can see:
(Which if I understand correctly, is kDNSServiceErr_Timeout).
I would have thought it indicated some issue with our Network Extension, but when I got to sample the extension when network was frozen, I could see the following stack:
Which if I understand correctly, indicates extension callbacks weren't even called in the time of the sample.
I also see that memory for network extension grows through time, which might indicate some kind of leak.
My question is - is that a known issue for network extension? How can I debug network extension with instruments? It crashes immediately when I try to attach to it.
Thanks!
On console we can see that there was a crash in UserEventAgent:
Code Block language Termination Reason: WATCHDOG, [0x1] monitoring timed out for service Termination Details: WATCHDOG, remoted connection down, inducing a crash
And on system.log we can see:
Code Block language UserEventAgent[9151]: assertion failed: 19G2021: com.apple.bonjour + 6922 [54D5EA10-98BA-3AD4-94C3-182BB3700419]: 0xfffffffffffeffe0
(Which if I understand correctly, is kDNSServiceErr_Timeout).
I would have thought it indicated some issue with our Network Extension, but when I got to sample the extension when network was frozen, I could see the following stack:
Code Block language Call graph: 2833 Thread_159027: Main Thread DispatchQueue_<multiple> + 2833 _dispatch_sig_thread (in libdispatch.dylib) + 53 [0x7fff71ec6476] + 2833 _dispatch_sigsuspend (in libdispatch.dylib) + 36 [0x7fff71ec649a] + 2833 sigsuspend_nocancel (in libsystem_kernel.dylib) + 10 [0x7fff72056502] 2833 Thread_170723 + 2833 thread_start (in libsystem_pthread.dylib) + 15 [0x7fff7210fb8b] + 2833 _pthread_start (in libsystem_pthread.dylib) + 148 [0x7fff72114109] + 2833 Poco::ThreadImpl::runnableEntry(void*) (in libPocoFoundation.60.dylib) + 94 [0x10327b2fe] + 2833 Poco::ActiveDispatcher::run() (in libPocoFoundation.60.dylib) + 72 [0x10327f598] + 2833 Poco::NotificationQueue::waitDequeueNotification() (in libPocoFoundation.60.dylib) + 392 [0x103243e48] + 2833 Poco::EventImpl::waitImpl() (in libPocoFoundation.60.dylib) + 70 [0x10320c8a6] + 2833 _pthread_cond_wait (in libsystem_pthread.dylib) + 698 [0x7fff72114425] + 2833 psynch_cvwait (in libsystem_kernel.dylib) + 10 [0x7fff72053882] 2833 Thread_180423 + 2833 thread_start (in libsystem_pthread.dylib) + 15 [0x7fff7210fb8b] + 2833 _pthread_start (in libsystem_pthread.dylib) + 148 [0x7fff72114109] + 2833 Poco::ThreadImpl::runnableEntry(void*) (in libPocoFoundation.60.dylib) + 94 [0x10327b2fe] + 2833 Poco::ActiveDispatcher::run() (in libPocoFoundation.60.dylib) + 72 [0x10327f598] + 2833 Poco::NotificationQueue::waitDequeueNotification() (in libPocoFoundation.60.dylib) + 392 [0x103243e48] + 2833 Poco::EventImpl::waitImpl() (in libPocoFoundation.60.dylib) + 70 [0x10320c8a6] + 2833 _pthread_cond_wait (in libsystem_pthread.dylib) + 698 [0x7fff72114425] + 2833 psynch_cvwait (in libsystem_kernel.dylib) + 10 [0x7fff72053882] 2833 Thread_209573 DispatchQueue_59: NEFilterExtensionProviderContext queue (serial) + 2833 start_wqthread (in libsystem_pthread.dylib) + 15 [0x7fff7210fb77] + 2833 _pthread_wqthread (in libsystem_pthread.dylib) + 290 [0x7fff72110a3d] + 2833 _dispatch_workloop_worker_thread (in libdispatch.dylib) + 596 [0x7fff71ec5c09] + 2833 _dispatch_lane_invoke (in libdispatch.dylib) + 363 [0x7fff71ebc5d6] + 2833 _dispatch_lane_serial_drain (in libdispatch.dylib) + 263 [0x7fff71ebbaf6] + 2833 _dispatch_source_invoke (in libdispatch.dylib) + 2084 [0x7fff71ec84be] + 2833 _dispatch_continuation_pop (in libdispatch.dylib) + 414 [0x7fff71eb8818] + 2833 _dispatch_client_callout (in libdispatch.dylib) + 8 [0x7fff71eb6658] + 2833 -[NEFilterDataExtensionProviderContext handleSocketSourceEventWithSocket:] (in NetworkExtension) + 1115 [0x7fff3e92e818] + 2833 -[NEFilterDataExtensionProviderContext handleDataCompleteForFlow:direction:reply:controlSocket:completionHandler:] (in NetworkExtension) + 381 [0x7fff3e92bf09] + 2833 -[NEFilterDataSavedMessageHandler enqueueWithFlow:context:] (in NetworkExtension) + 183 [0x7fff3e93085c] + 2833 -[NEFilterDataSavedMessageHandler executeWithFlow:context:] (in NetworkExtension) + 294 [0x7fff3e9309a4] + 2833 -[NEFilterDataSavedMessageHandler executeVerdictHandlerWithFlow:verdict:context:] (in NetworkExtension) + 305 [0x7fff3e930b83] + 2833 114-[NEFilterDataExtensionProviderContext handleDataCompleteForFlow:direction:reply:controlSocket:completionHandler:]_block_invoke.312 (in NetworkExtension) + 133 [0x7fff3e92c03d] + 2833 -[NEFilterSocketFlow createDataCompleteReply:controlSocket:direction:verdict:context:] (in NetworkExtension) + 174 [0x7fff3e9362dc] + 2833 -[NEFilterSocketFlow createDataReply:controlSocket:direction:verdict:context:] (in NetworkExtension) + 109 [0x7fff3e936215] + 2833 -[NEFilterSocketFlow writeCurrentVerdictWithMessage:controlSocket:] (in NetworkExtension) + 366 [0x7fff3e936479] + 2833 +[NEFilterSocketFlow writeMessageWithControlSocket:drop:socketID:inboundPassOffset:inboundPeekOffset:outboundPassOffset:outboundPeekOffset:statsReportFrequency:] (in NetworkExtension) + 158 [0x7fff3e9368eb] + 2833 write (in libsystem_kernel.dylib) + 10 [0x7fff72053bf6] 2833 Thread_210045 2833 start_wqthread (in libsystem_pthread.dylib) + 15 [0x7fff7210fb77] 2833 _pthread_wqthread (in libsystem_pthread.dylib) + 390 [0x7fff72110aa1] 2833 __workq_kernreturn (in libsystem_kernel.dylib) + 10 [0x7fff720524ce]
Which if I understand correctly, indicates extension callbacks weren't even called in the time of the sample.
I also see that memory for network extension grows through time, which might indicate some kind of leak.
My question is - is that a known issue for network extension? How can I debug network extension with instruments? It crashes immediately when I try to attach to it.
Thanks!