Skip to content

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

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

Podfile post_install disables Swift optimization for the affected pods only:

if ['FirebaseFunctions', 'FirebaseStorage'].include?(target.name)
  target.build_configurations.each do |config|
    if config.name != 'Debug'
      config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
    end
  end
end

Resolution Criteria

Remove the Podfile workaround 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)

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions