Skip to content

Crash on cancel: [__NSTaggedDate countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance #2441

@nickm01

Description

@nickm01

Getting the following sporadic crash. Seems like we are using strict concurrency but a number of cases of unchecked means that we bypass the guarantee.

Image

Here's some code from the trace

actor CachedAsyncImageCacheProcessor: CachedAsyncImageCacheProcessable {
...
    func cancel(url: URL) {
        guard let downloadTaskCount = pendingTasksURLMap[url] else { return }

        if downloadTaskCount.`count` == 0 {
            downloadTaskCount.task.cancel()
            pendingTasksURLMap[url] = nil
            imageRetriever.cancel(url: url) // traces here
        } else {
            pendingTasksURLMap[url] = TaskCount(task: downloadTaskCount.task, count: downloadTaskCount.count - 1)
        }
    }
...
}

class RemoteImageManager: CachedAsyncImageRetrievable {
...
    func cancel(url: URL) {
        worker.cancelDownload(url: url) // traces here
    }
...
}

final class KingfisherWorker: RemoteImageWorkable {
...
    func cancelDownload(url: URL) {
        KingfisherManager.shared.downloader.cancel(url: url) // traces here
    }
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions