Skip to content

fix(): prevent iOS startup hang while loading protocol modules - #305

Open
PeratX wants to merge 1 commit into
airgap-it:masterfrom
PeratX:fix/ios-startup-result-race
Open

fix(): prevent iOS startup hang while loading protocol modules#305
PeratX wants to merge 1 commit into
airgap-it:masterfrom
PeratX:fix/ios-startup-result-race

Conversation

@PeratX

@PeratX PeratX commented Jul 26, 2026

Copy link
Copy Markdown

Summary

  • make early JavaScript results and waiter registration atomic within one actor
  • preserve results that arrive before awaitResultWithID(_:) registers its continuation
  • restrict StatusBar.setBackgroundColor to Android, where the Capacitor API is implemented

Root cause

iOS protocol-module loading evaluates JavaScript and then awaits a result by ID. The existing implementation split result storage and listener registration across two actors. A JavaScript result could arrive after the result lookup but before the waiter was registered. The notification then removed the listener entry, and the late continuation was never resumed, leaving startup permanently waiting on the native launch screen.

The reported Error: not implemented message came from calling the Android-only status-bar background-color API on iOS. It occurs after protocol initialization and was not the cause of the startup hang, but this PR removes that unrelated error as well.

Validation

  • reproduced with the latest App Store client, version 3.34.4, on an iPhone 7 Plus running iOS 15.8.5
    • 15 of 20 launches remained on the native launch screen after four seconds
    • one affected launch was still stuck after an additional 30 seconds
  • built and installed the patched v3.34.4 source under a separate bundle identifier so the existing app and data were not overwritten
  • completed initial setup and launched the patched build successfully 5 consecutive times on the same physical device
  • passed 50,000 result-before-wait, wait-before-result, and concurrent actor interleavings
  • passed the production Angular build, Capacitor iOS sync, and complete arm64 iOS build

References #218

@PeratX
PeratX marked this pull request as ready for review July 26, 2026 04:59
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant