Skip to content

iOS crash popup on relaunch after hard-close with active LiveKit session #154

@benyaminR

Description

@benyaminR

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

  1. Connect to a LiveKit room with active livestream

  2. Force-close the app

  3. Relaunch within 5 seconds

  4. 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

Savvy-2025-09-08-170056.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions