Skip to content

iOS: crash (EXC_BREAKPOINT) with expo-updates 57 when launchAssetUrl() is read before AppController starts #507

Closed

Description

@malopezr7

Versions

  • @callstack/react-native-brownfield 6.0.0 (also on main at 5aa76a4)
  • expo-updates 57.0.26 (~57.0.26), Expo SDK 57
  • iOS, Expo runtime (ios/Expo)

What happens

A native iOS host crashes with EXC_BREAKPOINT when it creates its first React Native surface with ReactNativeBrownfield.shared.view(...) and the app has Updates enabled (updates.enabled: true, checkAutomatically: ON_LOAD).

Reproduction

  1. Expo SDK 57 app packaged with brownfield package:ios, with expo-updates enabled.
  2. In the native host, create a surface with ReactNativeBrownfield.shared.view(...).
  3. The app crashes before the surface loads.

Cause

Brownfield calls AppController.sharedInstance.launchAssetUrl() before the controller is started:

  • ExpoUpdatesStartup.prepareReactNative checks controller.launchAssetUrl() != nil before it calls controller.start().
  • ExpoHostRuntimeDelegate.bundleURL() and isBundleURLStable call it too, which can also happen before start().

In expo-updates 57, EnabledAppController.launchAssetUrl() reads startupProcedure, an implicitly unwrapped optional that only start() sets:

private var startupProcedure: StartupProcedure!

public func launchAssetUrl() -> URL? {
  return startupProcedure.launchAssetUrl()
}

So the call traps. expo-updates 58 made startupProcedure optional (startupProcedure?.launchAssetUrl()), which is why Expo 58 doesn't crash.

Proposed fix

Check AppController.sharedInstance.isStarted before calling launchAssetUrl() in those three places. Before start() there is no launch asset anyway, so the behavior on Expo 58 doesn't change. We have run this as a local patch on an Expo 57 brownfield host, and OTA updates and rollback work with it. I'll open a PR.

Activity

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

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