Nuke icon indicating copy to clipboard operation
Nuke copied to clipboard

Crash in ImagePipeline

Open wroluk opened this issue 1 year ago • 3 comments

Im using a LazyImage with a ImagePipeline. It is crashing consistently when the image is being fetched. Im using the latest Nuke release 12.1.6. (crashes as well on 12.0.0)

Here is the code. Below you can find the stacktrace.

@MainActor
public struct MyView: View {
    static let imagePipeline = ImagePipeline(configuration: .withDataCache(sizeLimit: 10 * 1024 * 1024))
    ...
    public var body: some View {
    ...
            LazyImage(url: url) { state in
                if let image = state.image {
                    image.resizable().aspectRatio(contentMode: .fill)
                } else if state.error != nil {
                    Color.clear // indicates an error
                } else {
                    Color.clear // acts as a placeholder
                }
            }.pipeline(Self.imagePipeline)
    ...
    }
}

Stacktrace:

Thread 11 Crashed:: Dispatch queue: com.github.kean.Nuke.ImagePipeline 0 0x110519cdc ??? 1 0x10ade5c48 ??? 2 libswiftCore.dylib 0x121aea63a Dictionary.subscript.getter + 154 3 DesignSystemFramework 0x1187561ac ImageRequest.scale.getter + 268 4 DesignSystemFramework 0x1187464cb ImageDecoders.Default.init(context:) + 251 5 DesignSystemFramework 0x1187463c4 ImageDecoders.Default.__allocating_init(context:) + 52 6 DesignSystemFramework 0x118744989 implicit closure #1 in ImageDecoderRegistry.init() + 73 7 DesignSystemFramework 0x1187449b3 thunk for @escaping @callee_guaranteed (@guaranteed ImageDecodingContext) -> (@owned ImageDecoders.Default?) + 19 8 DesignSystemFramework 0x11874508a thunk for @escaping @callee_guaranteed (@guaranteed ImageDecodingContext) -> (@out ImageDecoding?) + 42 9 DesignSystemFramework 0x11874504b thunk for @escaping @callee_guaranteed (@in_guaranteed ImageDecodingContext) -> (@out ImageDecoding?) + 75 10 DesignSystemFramework 0x118744e61 ImageDecoderRegistry.decoder(for:) + 721 11 DesignSystemFramework 0x11878dca9 closure #1 in variable initialization expression of ImagePipeline.Configuration.makeImageDecoder + 89 12 DesignSystemFramework 0x118790d9d ImagePipelineDelegate.imageDecoder(for:pipeline:) + 205 13 DesignSystemFramework 0x11879159d protocol witness for ImagePipelineDelegate.imageDecoder(for:pipeline:) in conformance ImagePipelineDefaultDelegate + 13 14 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba94454 TaskFetchDecodedImage.getDecoder(for:) + 452 15 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba93dce TaskFetchDecodedImage.didReceiveData(:urlResponse:isCompleted:) + 1118 16 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba9392f closure #1 in TaskFetchDecodedImage.start() + 287 17 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba8d4c9 closure #1 in AsyncTask.Publisher.subscribe<A>(:onValue:) + 777 18 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba8d647 partial apply for closure #1 in AsyncTask.Publisher.subscribe<A>(_:onValue:) + 55 19 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba8bdc4 AsyncTask.send(event:) + 724 20 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba8b896 AsyncTask.send(value:isCompleted:) + 310 21 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba99170 TaskFetchOriginalImageData.dataTaskDidFinish(error:) + 832 22 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba98e23 closure #1 in closure #2 in TaskFetchOriginalImageData.loadData(urlRequest:finish:) + 67 23 NukeUI_1A7D877EC7EDF7_PackageProduct 0x13ba10898 thunk for @escaping @callee_guaranteed () -> () + 40 24 libdispatch.dylib 0x11ffd4e40 _dispatch_call_block_and_release + 12 25 libdispatch.dylib 0x11ffd60d9 _dispatch_client_callout + 8 26 libdispatch.dylib 0x11ffddb23 _dispatch_lane_serial_drain + 1008 27 libdispatch.dylib 0x11ffde7ef _dispatch_lane_invoke + 400 28 libdispatch.dylib 0x11ffeb475 _dispatch_workloop_worker_thread + 873 29 libsystem_pthread.dylib 0x120eadc55 _pthread_wqthread + 327 30 libsystem_pthread.dylib 0x120eacbbf start_wqthread + 15

wroluk avatar Oct 18 '23 09:10 wroluk

The crash does not happen always but quite often.

wroluk avatar Oct 19 '23 08:10 wroluk

Hey, thanks for the report. From the top of my head, I'm not sure what might might be causing the crash.

I see in the report that the Nuke APIs are reported as part of the DesignSystemFramework. Is it a custom framework? Was the code from the framework modified?

kean avatar Nov 05 '23 22:11 kean

DesignSystemFramework is a dynamic library inside a local Swift package. Nuke(UI) was not modified in any way.

We found out in the meantime that if we remove .pipeline(Self.imagePipeline) then there is no crash.

wroluk avatar Nov 21 '23 17:11 wroluk

Hi, are you still able to reproduce this crash? Is it OK to close the issue?

kean avatar Feb 18 '24 17:02 kean

I will check and let you know. Just give me some time. BTW, did you apply any fix?

niedz., 18 lut 2024 o 18:57 Alex Grebenyuk @.***> napisał(a):

Hi, are you still able to reproduce this crash? Is it OK to close the issue?

— Reply to this email directly, view it on GitHub https://github.com/kean/Nuke/issues/731#issuecomment-1951399052, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEUHNYV4LVBHMK76QOIOEOLYUI6HTAVCNFSM6AAAAAA6FHBQ3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJRGM4TSMBVGI . You are receiving this because you authored the thread.Message ID: @.***>

wroluk avatar Feb 20 '24 21:02 wroluk

No, I don't think I've made any changes that could affect this part of the framework.

kean avatar Feb 20 '24 21:02 kean