NEPacketTunnelProvider died unexpectedly, no crash dump

Hello,

I'm trying to debug an intermittent crash in my NEPacketTunnelProvider. Basically, it will sometimes crash about a minute after establishing a connection. If it survives the first couple minutes, it will work fine for the duration of the connection.


My main problem is that there doesn't appear to be any crash dump created. My provider just stops logging, and I see the following logged in the Console:


neagent: extension connection was interrupted
neagent: Extension <my extension ID> died unexpectedly
nesessionmanager: NESMVPNSession[<uuid>]: status changed to disconnecting


The crash happens only on macOS; iOS is fine.


A few things I've tried:

  • Checked for a crash dump in ~/Library/Logs/DiagnosticReports and /Library/Logs/DiagnosticReports; found nothing related to my provider.
  • Attached the Xcode debugger. I can never get it to crash with the debugger attached (of course 😝).
  • Monitored memory usage in Xcode. It's typically around 6.7MB, but can drift up close to 8MB during heavy traffic. I believe this is acceptable?
  • Added an uncaught exception handler via NSSetUncaughtExceptionHandler. But my handler never gets called; I suspect this isn't supported for extensions?
  • Followed instructions for Crash Logs and VPN Logging.


Has anybody run into an issue like this? Is there some other way to gather info that I'm missing?


Thanks,

Mike

Replies

The crash happens only on macOS; iOS is fine.

This sounds very much like a problem I’ve seen reported by other developers (r. 32073323). On macOS only, if you stop and then immediately (within 5 seconds) start a packet tunnel provider, the provider will spontaneously stop about 20 seconds later. The problem is still being investigated by R&D engineering.

Does that match what you’re seeing?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Yep, that sounds like it. Is there any info I can provide that would help the investigation?

Is there any info I can provide that would help the investigation?

No, that’s not necessary. I can reproduce it with my own tiny packet tunnel provider test project.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

FYI I can still reproduce this bug on macOS 10.13 Beta 9.


Are you able to share any progress/updates regarding a fix? Thanks!

Are you able to share any progress/updates regarding a fix?

I’ve nothing to concrete to report, alas.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

We're seeing it consistently also, on 10.12 and 10.13. Exact same repro as Quinn described.

This is still an issue in macOS High Sierra 10.13.1 beta 2 (17B35a).

Still crash on macOS High Sierra 10.13.4(17E199)

Seems like it's still crashes on macOS Mojave 10.14.1

The solution to apple bug 32073323 is to add a call to `exit(0)` to the provider's stopTunnel method. For example:


override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {

// Do your normal tunnel stopping stuff


completionHandler()


#if os(macOS)

// HACK: This is a filthy hack to work around Apple bug 32073323. Remove it when

// they finally fix this upstream and the fix has been rolled out widely enough.

exit(0)

#endif

}

It's been 2 years already. This is still around in Mojave and is crazy stuff.


It's unacceptable for such a severe bug to live this long without any feedback from Apple. No surprise as I have had other major issues and they pretty much received the same treatment, despite being properly and thoroughly reported. Ignored, marked as duplicate (i.e. no updates), stuck forever.


I kind of hate this behavior, because in this case I have a decent user base for my app and people legitimately need answers. Everybody in software is asked deadlines. I can't possibly believe that in 2 years nobody looked into what is a severe bug nonetheless. More so given that the bug can be reproduced consistently.


Absurd.

I'll try this ASAP. Did you find it by luck or through advice by an Apple agent?

any luck with this solution?

With regards this bug (r. 32073323), I’m sad to report that there’s still no fix in sight here )-: However, the workaround suggested by zx2c4 does seem to help.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Anything new after one more year passed?

I think I have the same problem, but using systems IKEv2. If mac goes to sleep for about 5 minutes, after it wakes up, VPN connection gets dropped ant it reconnects. Then after 20 seconds that new connection drops.

In console I can see this log: `Extension com.apple.NetworkExtension.IKEv2Provider died unexpectedly`.


Looks like it got as lot worse in Catalina, especially the latest 10.15.4.


If you need any information I'll be glad to provide it.