Infinite crashes caused by on-demand

Hi There,

If some code in the packet tunnel provider caused a crash, it seems like on-demand will bring back the tunnel and then the tunnel crashes again. This is an infinite loop and on iOS, it's not very obvious for the users to understand what's going on there. Is there a way to programmatically disable on-demand feature within packet tunnel provide?

Is there a way to programmatically disable on-demand feature within packet tunnel provide?

No.

I agree that the system should do a better job about protecting the user from this, and I encourage you to file a bug along those lines. Please post your bug number, just for the record.

However…

Most folks who hit this problem have set up a very broad on-demand rules because they’re trying to use a packet tunnel provider for something other than acting as a VPN. This is yet another example of the “weird and wonderful” problems that I mentioned here.

On the workaround front, you could have your provider keep a persistent record of when it’s launched and when it has successfully connected. If it’s launched without successfully connecting many time over a short period, it could go into a ‘safe’ mode where it immediately fails any connection attempt. That safe mode should run very little code, and thus it’ll minimise the chances of it crashing again.

Share and Enjoy

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

Thanks Quinn! I filed FB11856481.

I also thought about showing an alert directly from the packet tunnel provider to ask the user to disable VPN from the container app using displayMessage completionHandler, however, this method stops working on my iOS 16 test devices. I know it's marked as deprecated, but it used to work just fine on my iOS 15 devices, do you have any insights on why it stops working? Thanks.

I filed FB11856481.

Thanks.

do you have any insights on why it stops working?

No. I haven’t played around with that mechanism in years, not since we added the User Notification framework.

Share and Enjoy

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

Infinite crashes caused by on-demand
 
 
Q