We're seeing some new and odd behavior where our NEPacketTunnelProvider instance is receiving a stopTunnelWithReason:completionHandler: call with reason NEProviderStopReasonInternalError.
Can anyone shed some light into how to diagnose this situation?
Here are some basic details:
-
Our PacketTunnel has been in use for years and we only started seeing this issue recently.
-
We're able to reproduce this behavior with some light browsing.
-
The documentation provides no insight on why/when this might occur. Can anyone shed some light into how to diagnose this situation?
Things we’ve tried so far:
-
We grabbed a sysdiagnose and looked through the logs:
a. Right before the stopTunnel, we see log items referring to a "nesessionmanager" (PID 2038) getting killed. Presumably, this is due to hitting a highwater threshold. (See sysdiagnose items listing below)
b. Thinking these were due to memory pressure, we added logging of available/used memory.
c. We confirmed that the PacketTunnel was only using 11,808.73 KB.
d. Since, there is plenty of memory available the PacketTunnel was not killed for using too much memeory.
-
We wondered if this could be due to our UI's usage of objects like: NETunnelProviderManager and NETunnelProviderSession
a. We ran an experiment where we swiped closed the UI to ensure these manager/session objects are not used.
b. Without the UI, we still saw the random stopTunnel with NEProviderStopReasonInternalError.
-
We wondered if our routes were the problem, but they seem correct.
a. See the NEPacketTunnelNetworkSettings listing below
LISTING: From the system_logs.logarchive, the nesessionmanager log items:
2025-01-23 15:07:59.176146 -0800 0x278 memorystatus com.apple.xnu memorystatus: killing process 2038 [nesessionmanager] in high band ? (140) - memorystatus_available_pages: 18932 default kernel 2025-01-23 15:07:59.179641 -0800 0x278 memorystatus com.apple.xnu memorystatus: killing_highwater_process pid 2038 [nesessionmanager] (highwater 140) 7056KB - memorystatus_available_pages: 19161 compressor_size:69593 default kernel 2025-01-23 15:07:59.179888 -0800 0x278 memorystatus com.apple.xnu memorystatus: failed to kill a process and no memory was reclaimed default kernel 2025-01-23 15:07:59.185695 -0800 1 0x45e0c user/501/com.apple.nesessionmanager [2038] exited with exit reason (namespace: 1 code: 0x2) - JETSAM_REASON_MEMORY_HIGHWATER, ran for 266329ms default launchd 2025-01-23 15:07:59.231188 -0800 31 0x45bf2 com.apple.networkextension nesessionmanager(2038) exited default UserEventAgent 2025-01-23 15:07:59.253371 -0800 31 0x45bf2 com.apple.networkextension nesessionmanager exited with active sessions, re-launching nesessionmanager to clear agent status default UserEventAgent
LISTING: From the system_logs.logarchive, the stopTunnel from PID 2046
2025-01-23 15:07:59.201581 -0800 SamplePacketTunnel [Extension com.REDACTED.PacketTunnel]: Calling stopTunnelWithReason because: None 2025-01-23 15:08:20.783112 -0800 SamplePacketTunnel 2025-01-23 15:08:20,786 2046 ERROR REDACTED (285805) - Exiting after waiting for stopTunnelWithReason
LISTING: routes from NEPacketTunnelNetworkSettings
{ tunnelRemoteAddress = fd12:3456:789a:1::1 DNSSettings = { protocol = cleartext server = ( 2606:4700:4700::1234, 2606:4700:4700::2345, ) matchDomains = ( , ) matchDomainsNoSearch = NO } IPv6Settings = { configMethod = manual addresses = ( fd12:3456:789a:1::1, ) networkPrefixLengths = ( 64, ) includedRoutes = ( { destinationAddress = 2606:4700:4700::2345 destinationNetworkPrefixLength = 128 }, { destinationAddress = 2606:4700:4700::1234 destinationNetworkPrefixLength = 128 }, ) excludedRoutes = ( { destinationAddress = REDACTED destinationNetworkPrefixLength = 128 }, { destinationAddress = REDACTED destinationNetworkPrefixLength = 128 }, ) } MTU = 3072 }
Thanks for taking a look, any help or suggestions would be greatly appreciated
OK.
Yeah, that’s the best path forward here.
If you have any info about the first OS release with this problem, please add it to your bug.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"