Skip to content

iOS Release crash: Swift 6.1 async let teardown bug in FirebaseFunctions/FirebaseStorage #76

@gotnull

Description

@gotnull

Summary

iOS Release/Profile builds crash with SIGABRT (_swift_task_dealloc_specific / freed pointer was not the last allocation) on cooperative queue threads whenever code calls FirebaseFunctions.httpsCallable.call() or FirebaseStorage.ref.putData(). Debug builds are unaffected.

Root Cause

Swift 6.1 compiler bug - the optimizer generates incorrect LIFO teardown ordering for async let task allocations.

Exposed by flutterfire#18054 (feat(ios): migrate iOS to UIScene lifecycle), which shipped new Swift async code in:

  • cloud_functions 6.0.7 → 6.1.0
  • firebase_storage 13.1.0 → 13.2.0

Upstream Tracking

Issue Status
swiftlang/swift#81771 Swift compiler bug report
swiftlang/swift#87571 Fix PR (not yet merged)
flutterfire#18153 FlutterFire tracking issue
Swift Forums discussion Community discussion

Current Workaround

Version pinning in pubspec.yaml to pre-UIScene migration versions:

firebase_storage: 13.1.0  # 13.2.0 triggers Swift 6.1 SIGABRT
cloud_functions: 6.0.7    # 6.1.0 triggers Swift 6.1 SIGABRT

This avoids the problematic native Swift async code entirely - no Podfile hacks, no -Onone overrides, no performance penalty.

Previously attempted workarounds (not recommended)

  • Podfile -Onone: Fragile, disables Swift optimization for entire pods, hard to know which pods to cover.
  • Pure Dart HTTP REST bypass: Works but loses native SDK benefits (retries, App Check, offline queueing).

Resolution Criteria

Unpin to ^ versions once any of:

  1. Swift compiler fix (swiftlang/swift#87571) ships in an Xcode update
  2. FlutterFire releases patched cloud_functions / firebase_storage versions
  3. Firebase iOS SDK adds its own workaround

Affected Versions

  • Build 139 (1.24.0+139)
  • Xcode 26.4, Swift 6.1, iOS 26.4
  • Physical devices only (simulator uses macOS Swift runtime)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions