-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Summary
On iOS (TestFlight builds), when the app is force-closed while connected to a LiveKit session (with an active livestream) and relaunched within 5 seconds, iOS shows a “App was terminated because it failed to terminate gracefully after 5.0s” popup.
This does not occur:
-
In development builds (debug/profile)
-
If the app is relaunched after 5s
-
If no LiveKit session is active
Crash Logs
Excerpt from .ips crash report:
Failed to terminate gracefully after 5.0s
Apple’s watchdog indicates the app is blocked during termination, likely due to LiveKit resources not shutting down fast enough (sockets, media tracks, AVFoundation).
Steps to Reproduce
-
Connect to a LiveKit room with active livestream
-
Force-close the app
-
Relaunch within 5 seconds
-
App hangs briefly → iOS shows crash popup
No popup if:
-
Relaunch happens after 5s
-
No LiveKit session was active
Where it happens
-
Only reproducible in TestFlight / App Store builds
-
Not reproducible in simulator
-
Consistently occurs when a LiveKit session is active during termination
Possible Causes
-
LiveKit socket not closing in time
-
Ongoing HTTP requests blocking shutdown
-
AVFoundation camera/mic teardown delay
🔗 References
Notes
-
Issue only visible in TestFlight / production builds
-
App was still accepted by App Review despite the popup
-
Some developers ship anyway, but the problem appears directly tied to LiveKit teardown