Skip to content

Crash in StorageObservableTask / StorageDownloadTask.enqueueImplementation — recurring since at least SDK 10.11.0 (see #11875), still present in 12.16.0 #16410

Description

@Lazynius1

Description

We're seeing crashes deep inside FirebaseStorage's task/observer lifecycle:

#9  StorageObservableTask.removeAllObservers() (StorageObservableTask.swift:113)
#10 StorageDownloadTask.enqueueImplementation(resumeWith:) (StorageDownloadTask.swift:179)
#11 closure #1 in StorageDownloadTask.enqueue() (StorageDownloadTask.swift:42)

This looks like the same crash family reported in #11875 ("Crash in StorageObservableTask"), which was closed due to inactivity/no-recent-activity rather than being fixed. That report was on SDK 10.11.0 (Xcode 14.3) with a crash in StorageObservableTask.fire(handlers:snapshot:) called from StorageDownloadTask.enqueueImplementation. We're now seeing a crash in the same file/class (removeAllObservers(), also called from enqueueImplementation) on SDK 12.16.0 — so this appears to be a long-standing, unresolved issue in the observer/task lifecycle of StorageObservableTask, not something fixed between those versions.

Our usage of Storage is the standard documented pattern (task.observe(.progress), .observe(.success), .observe(.failure)) — we don't call removeAllObservers() ourselves. The crash happens inside the SDK's own task enqueue/observer teardown path, which suggests a threading race: removeAllObservers() mutating the observer collection while a task is concurrently enqueuing/firing handlers.

It's happened without any obvious trigger on our end — once with no user interaction in progress, and once while the user was simply adjusting an unrelated UI control (a drawing tool size slider) with no Storage activity intentionally initiated at that moment, suggesting a background download/upload task's async callback raced with a teardown.

Reproducing the issue

No consistent repro steps yet — it appears intermittently during normal app usage while Storage downloads/uploads are happening in the background (chat media, story assets), not tied to a specific user action. Will update if we find a reliable repro.

Firebase SDK Version

12.16.0

Xcode Version

27 beta 3

Installation Method

Swift Package Manager

Firebase Product(s)

Storage

Targeted Platforms

iOS

Relevant Log Output

#9  0x0000000109d2fa68 in StorageObservableTask.removeAllObservers() at FirebaseStorage/Sources/StorageObservableTask.swift:113
#10 0x0000000109d1e7ec in StorageDownloadTask.enqueueImplementation(resumeWith:) at FirebaseStorage/Sources/StorageDownloadTask.swift:179
#11 0x0000000109d1a35c in closure #1 in StorageDownloadTask.enqueue() at FirebaseStorage/Sources/StorageDownloadTask.swift:42

Will enable -FIRDebugEnabled and update with fuller logs if it recurs.

If using Swift Package Manager, the project's Package.resolved

No response

If using CocoaPods, the project's Podfile.lock

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions