(ios) neagent failed to create an NSExtension with type error

I have an app+networkextension (packet tunnel provider) combination. When i first install (or do a fresh install), app gets installed and the packet tunnel gets setup and works fine. the problem is with "upgrade" - if i give my enterprise users a new version, and they start install/download, i am seeing multiple issues (most probably pointing to a race condition). this problem happens 3 out of 5 times.


- current app is attempted to to be taken down

- tunnel extension is sent "stopTunnel.." and i see that tunnel is properly exited/terminated (atleast from the log thats what i get the feeling)

- at this point or in between, the new app is attempted to be downloaded from safari (in-house distribution or crashlytics/fabric), which fails probably because the network is not available as the tunnel is down.

- springboard app icon is kind of stuck sometimes in "waiting"

- or "cannot download app" alert is shown sometimes.


are there any pointers to investigate / fix this issue ? right now i am looking at the logs using console app


Some log lines that are of interest:

default 23:28:20.734733 -0700 vpntunnel stopTunnelWithReason++ UserInitiated 1

default 23:28:20.756196 -0700 configd IPv6 over pdp_ip0 demoted: not primary for IPv4

default 23:28:20.798936 -0700 configd network changed

default 23:28:21.135161 -0700 kernel SIOCPROTODETACH_IN6: utun4 error=6

error 23:28:21.135652 -0700 vpntunnel SIOCGIFMTU failed: Device not configured

error 23:28:21.135830 -0700 vpntunnel NEVirtualInterfaceAdjustReadBufferSize: interface_get_mtu failed (6), defaulting to max mtu

default 23:28:21.138476 -0700 iap2d process com.company.ios.product.vpntunnel is now suspending

default 23:28:21.144167 -0700 nesessionmanager NESMVPNSession[Product VPN:B95C8DD6-6EA8-44DC-A429-E3A152F80F19]: status changed to disconnected, last stop reason Stop command received


default 23:28:21.157820 -0700 iap2d process com.company.ios.product.vpntunnel is now terminated

default 23:28:21.158172 -0700 symptomsd 3377 com.company.ios.product.vpntunnel : Terminated (most elevated: Terminated)

default 23:28:21.157820 -0700 iap2d process com.company.ios.product.vpntunnel: is now terminated

default 23:28:21.158172 -0700 symptomsd 3377 com.company.ios.product.vpntunnel:: Terminated (most elevated: Terminated)




default 23:28:21.906699 -0700 nesessionmanager NESMVPNSession[Product VPN:B95C8DD6-6EA8-44DC-A429-E3A152F80F19]: Received a start command from appstored[1674]

error 23:28:21.937375 -0700 neagent Failed to create an NSExtension with type com.company.ios.product.vpntunnel: (null)

error 23:28:21.937415 -0700 neagent NEAgentSession: failed to initialize the delegate

Replies

Could someone point out what is the expected behavior during app upgrade, specially in relation with network extension as it seems things can go wrong with timing of the events