Kingfisher: Crash reported by Fabric

Created on 25 Jan 2018  Â·  14Comments  Â·  Source: onevcat/Kingfisher

Check List

Issue Description

Using Kingfisher 4.6.1, we received a crash inside KingFisher that was reported to us by Fabric.

What

Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x00000001850be1e8
specialized ImageDownloaderSessionHandler.callCompletionHandlerFailure(error:url:)
 Raw Text

0  libdispatch.dylib              0x1850be1e8 _os_object_retain + 72
1  Kingfisher                     0x100b41848 specialized ImageDownloaderSessionHandler.callCompletionHandlerFailure(error:url:) (ImageDownloader.swift:525)
2  Kingfisher                     0x100b42e58 specialized ImageDownloaderSessionHandler.urlSession(_:task:didCompleteWithError:) (ImageDownloader.swift:475)
3  Kingfisher                     0x100b3b9a0 @objc ImageDownloaderSessionHandler.urlSession(_:task:didCompleteWithError:) (ImageDownloader.swift)
4  CFNetwork                      0x1869e69f8 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.185 + 72
5  Foundation                     0x186cf6754 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
6  Foundation                     0x186c3b2c8 -[NSBlockOperation main] + 96
7  Foundation                     0x186c2b8c4 -[__NSOperationInternal _start:] + 620
8  Foundation                     0x186cf8b00 __NSOQSchedule_f + 228
9  libdispatch.dylib              0x1850bd1c0 _dispatch_client_callout + 16
10 libdispatch.dylib              0x1850c1d6c _dispatch_main_queue_callback_4CF + 1000
11 CoreFoundation                 0x1861dff2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
12 CoreFoundation                 0x1861ddb18 __CFRunLoopRun + 1660
13 CoreFoundation                 0x18610c048 CFRunLoopRunSpecific + 444
14 GraphicsServices               0x187b92198 GSEventRunModal + 180
15 UIKit                          0x18c0f82fc -[UIApplication _run] + 684
16 UIKit                          0x18c0f3034 UIApplicationMain + 208

Other threads that might be related to the crash:

com.onevcat.Kingfisher.ImageDownloader.Cancel.default
0  libsystem_kernel.dylib         0x1851e41a8 semaphore_wait_trap + 8
1  libdispatch.dylib              0x1850cf7ec _dispatch_semaphore_wait_slow + 216
2  libswiftDispatch.dylib         0x10117bbec (Missing)
3  Kingfisher                     0x100b40e00 specialized closure #1 in ImageDownloader.setup(progressBlock:with:for:options:started:) (ImageDownloader.swift:396)
4  Kingfisher                     0x100b3b60c closure #1 in ImageDownloader.setup(progressBlock:with:for:options:started:) (ImageDownloader.swift)
5  Kingfisher                     0x100b45f28 partial apply for closure #1 in ImageDownloader.setup(progressBlock:with:for:options:started:) (ImageDownloader.swift)
6  Kingfisher                     0x100b2d384 thunk for @callee_owned () -> () (ImageCache.swift)
7  libdispatch.dylib              0x1850bd200 _dispatch_call_block_and_release + 24
8  libdispatch.dylib              0x1850bd1c0 _dispatch_client_callout + 16
9  libdispatch.dylib              0x1850cb444 _dispatch_queue_serial_drain + 928
10 libdispatch.dylib              0x1850c09a8 _dispatch_queue_invoke + 652
11 libdispatch.dylib              0x1850cb940 _dispatch_queue_override_invoke + 360
12 libdispatch.dylib              0x1850cd38c _dispatch_root_queue_drain + 572
13 libdispatch.dylib              0x1850cd0ec _dispatch_worker_thread3 + 124
14 libsystem_pthread.dylib        0x1852c62b8 _pthread_wqthread + 1288
15 libsystem_pthread.dylib        0x1852c5da4 start_wqthread + 4

Reproduce

Unknown

Other Comment

The issue had previously been seen on Kingfisher 4.2.0 (Fabric), but we had hoped that it was already fixed in a later version. It seems it was not, and therefore I am reporting it now.

Most helpful comment

Yes,

I am rewriting this part and try to remove the semaphore related code. I hope I could release the new version (and quite a few other refactoring) soon.

All 14 comments

@bes Thanks for reporting this. It seems to be related on some operation of the semaphore. The libdispatch trapped it when waiting a semaphore. However, I am not sure whether it is an issue we could fix in Kingfisher or not. I would leave it open for a while and check again with related code again.

We have the exact same issue. Also Fabric reported us some crashes within Kingfisher. These two lines are the same:

1  Kingfisher                     0x100b41848 specialized ImageDownloaderSessionHandler.callCompletionHandlerFailure(error:url:) (ImageDownloader.swift:525)
2  Kingfisher                     0x100b42e58 specialized ImageDownloaderSessionHandler.urlSession(_:task:didCompleteWithError:) (ImageDownloader.swift:475)

So this does not seem to be an isolated/single case in one dedicated project.

I've also have a crash only on iOS 11 from ImageDownloader and CacheSerializer.

ImageDownloader.swift line 457
specialized ImageDownloaderSessionHandler.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data) -> ()

Fatal Exception: NSMallocException
0  CoreFoundation                 0x186207164 __exceptionPreprocess
1  libobjc.A.dylib                0x185450528 objc_exception_throw
2  Foundation                     0x186be1e58 _NSErrnoMessage
3  CoreFoundation                 0x186165790 __CFSafelyReallocate
4  Foundation                     0x186b193d4 _NSMutableDataGrowBytes
5  Foundation                     0x186b19200 -[NSConcreteMutableData appendBytes:length:]
6  Foundation                     0x186d4b7d4 __49-[_NSDispatchData enumerateByteRangesUsingBlock:]_block_invoke
7  libdispatch.dylib              0x185bdf364 _dispatch_data_apply
8  Foundation                     0x186d4b79c -[_NSDispatchData enumerateByteRangesUsingBlock:]
9  Foundation                     0x186b19068 -[NSConcreteMutableData appendData:]
10 Kingfisher                     0x10382b7d8 specialized ImageDownloaderSessionHandler.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data) -> () (ImageDownloader.swift:457)
11 Kingfisher                     0x1038248f8 @objc ImageDownloaderSessionHandler.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data) -> () (ImageDownloader.swift)
12 Pomelo                         0x102e8f678 -[NRURLSessionTaskDelegateBase URLSession:dataTask:didReceiveData:] (NRMAURLSessionTaskDelegateBase.m:63)
13 CFNetwork                      0x186943970 __67-[NSURLSession delegate_dataTask:didReceiveData:completionHandler:]_block_invoke.264
14 Foundation                     0x186bddba0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
15 Foundation                     0x186b1d894 -[NSBlockOperation main]
16 Foundation                     0x186b0d4c4 -[__NSOperationInternal _start:]
17 libdispatch.dylib              0x185b86a14 _dispatch_client_callout
18 libdispatch.dylib              0x185bc29c4 _dispatch_block_invoke_direct$VARIANT$armv81
19 libdispatch.dylib              0x185b86a14 _dispatch_client_callout
20 libdispatch.dylib              0x185bc29c4 _dispatch_block_invoke_direct$VARIANT$armv81
21 libdispatch.dylib              0x185bc2878 dispatch_block_perform$VARIANT$armv81
22 Foundation                     0x186bdf878 __NSOQSchedule_f
23 libdispatch.dylib              0x185b86a14 _dispatch_client_callout
24 libdispatch.dylib              0x185bc7c80 _dispatch_main_queue_callback_4CF$VARIANT$armv81
25 CoreFoundation                 0x1861af344 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
26 CoreFoundation                 0x1861acf20 __CFRunLoopRun
27 CoreFoundation                 0x1860ccc58 CFRunLoopRunSpecific
28 GraphicsServices               0x187f78f84 GSEventRunModal
29 UIKit                          0x18f8255c4 UIApplicationMain
30 Pomelo                         0x1028f6b5c main (PMLCategoryDetailsTableViewCell.swift:20)
31 libdyld.dylib                  0x185bec56c start

ImageDownloader.swift line 551
ImageDownloaderSessionHandler.(processImage(for : URLSessionTask, url : URL) -> ()).(closure #1)

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x1837ab164 __exceptionPreprocess
1  libobjc.A.dylib                0x1829f4528 objc_exception_throw
2  CoreFoundation                 0x1837ab0ac -[NSException initWithCoder:]
3  Foundation                     0x18410c4d0 NSAllocateMemoryPages
4  Foundation                     0x1840e3b8c _NSDataCreateVMDispatchData
5  Foundation                     0x1840af590 -[_NSPlaceholderData initWithBytes:length:copy:deallocator:]
6  libswiftFoundation.dylib       0x1021185cc (Missing)
7  libswiftFoundation.dylib       0x10205c7ac (Missing)
8  Kingfisher                     0x101880db0 ImageDownloaderSessionHandler.(processImage(for : URLSessionTask, url : URL) -> ()).(closure #1) (ImageDownloader.swift:551)
9  Kingfisher                     0x101871aec _T0Ieg_IeyB_TR (ImageCache.swift)
10 libdispatch.dylib              0x18312aa54 _dispatch_call_block_and_release
11 libdispatch.dylib              0x18312aa14 _dispatch_client_callout
12 libdispatch.dylib              0x183132f08 _dispatch_continuation_pop$VARIANT$mp
13 libdispatch.dylib              0x18313180c _dispatch_async_redirect_invoke$VARIANT$mp
14 libdispatch.dylib              0x183137cf4 _dispatch_root_queue_drain
15 libdispatch.dylib              0x183137a38 _dispatch_worker_thread3
16 libsystem_pthread.dylib        0x1833d306c _pthread_wqthread
17 libsystem_pthread.dylib        0x1833d2b6c start_wqthread

CacheSerializer.swift line 197
DefaultCacheSerializerdataData?UIImagewith first-element-marker UIImage

Fatal Exception: NSMallocException
0  CoreFoundation                 0x18132ed8c __exceptionPreprocess
1  libobjc.A.dylib                0x1804e85ec objc_exception_throw
2  Foundation                     0x181d5ad7c _NSErrnoMessage
3  CoreFoundation                 0x18128dfd8 __CFSafelyReallocate
4  Foundation                     0x181cc1b18 _NSMutableDataGrowBytes
5  Foundation                     0x181c8574c -[NSConcreteMutableData appendBytes:length:]
6  ImageIO                        0x1833fcd70 IIOImageWriteSession::putBytes(void const*, unsigned long)
7  ImageIO                        0x1833d0e4c iioWriteCallback(void*, int, void*)
8  AppleJPEG                      0x183350298 aj_ostream_write
9  AppleJPEG                      0x183372188 aj_block_encode_ac
10 AppleJPEG                      0x1833421d0 aj_encode_buffers_baseline
11 AppleJPEG                      0x183342618 aj_encode_row
12 AppleJPEG                      0x1833738f0 applejpeg_encode_image_row
13 ImageIO                        0x183530b8c AppleJPEGWritePlugin::writeOne(IIOImagePixelDataProvider*, IIODictionary*, IIODictionary*, unsigned int)
14 ImageIO                        0x183531b14 IIO_Writer_AppleJPEG::write(void*, void*)
15 ImageIO                        0x1834b9f48 IIOImageDestination::finalize()
16 UIKit                          0x18b318500 _UIImageJPEGRepresentation
17 Kingfisher                     0x1017c4990 DefaultCacheSerializerdataData?UIImagewith first-element-marker UIImage (CacheSerializer.swift:197)
18 Kingfisher                     0x1017c46fc DefaultCacheSerializerKingfisherCacheSerializer (CacheSerializer.swift)
19 Kingfisher                     0x1017ce524 ImageCache.(store(UIImage, original : Data?, forKey : String, processorIdentifier : String, cacheSerializer : CacheSerializer, toDisk : Bool, completionHandler : () -> ()?) -> ()).(closure #1) (ImageCache.swift:214)
20 Kingfisher                     0x1017da904 partial apply for ImageCache.(store(UIImage, original : Data?, forKey : String, processorIdentifier : String, cacheSerializer : CacheSerializer, toDisk : Bool, completionHandler : () -> ()?) -> ()).(closure #1) (ImageCache.swift)
21 Kingfisher                     0x1017cdaec _T0Ieg_IeyB_TR (ImageCache.swift)
22 libdispatch.dylib              0x180c20b24 _dispatch_call_block_and_release
23 libdispatch.dylib              0x180c20ae4 _dispatch_client_callout
24 libdispatch.dylib              0x180c5f1b4 _dispatch_queue_serial_drain$VARIANT$armv81
25 libdispatch.dylib              0x180c5fad8 _dispatch_queue_invoke$VARIANT$armv81
26 libdispatch.dylib              0x180c6047c _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81
27 libdispatch.dylib              0x180c6844c _dispatch_workloop_worker_thread$VARIANT$armv81
28 libsystem_pthread.dylib        0x180f53e70 _pthread_wqthread
29 libsystem_pthread.dylib        0x180f53b08 start_wqthread

I just wanted to say we're also getting crashes like the ones reported here, at:

ImageDownloader.swift line 486
specialized ImageDownloaderSessionHandler.urlSession(_:dataTask:didReceive:)

Fatal Exception: NSMallocException
Failed to grow buffer

Fatal Exception: NSMallocException
0  CoreFoundation                 0x186023164 __exceptionPreprocess
1  libobjc.A.dylib                0x18526c528 objc_exception_throw
2  Foundation                     0x1869fde58 _NSErrnoMessage
3  CoreFoundation                 0x185f81790 __CFSafelyReallocate
4  Foundation                     0x1869353d4 _NSMutableDataGrowBytes
5  Foundation                     0x186935200 -[NSConcreteMutableData appendBytes:length:]
6  Foundation                     0x186b677d4 __49-[_NSDispatchData enumerateByteRangesUsingBlock:]_block_invoke
7  Foundation                     0x186b6779c -[_NSDispatchData enumerateByteRangesUsingBlock:]
8  Foundation                     0x186935068 -[NSConcreteMutableData appendData:]
9  Kingfisher                     0x106da8b68 specialized ImageDownloaderSessionHandler.urlSession(_:dataTask:didReceive:) (ImageDownloader.swift:486)
10 Kingfisher                     0x106d9fb24 @objc ImageDownloaderSessionHandler.urlSession(_:dataTask:didReceive:) (ImageDownloader.swift)
11 CFNetwork                      0x18675f970 __67-[NSURLSession delegate_dataTask:didReceiveData:completionHandler:]_block_invoke.264
12 Foundation                     0x1869f9ba0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
13 Foundation                     0x186939894 -[NSBlockOperation main]
14 Foundation                     0x1869294c4 -[__NSOperationInternal _start:]
15 libdispatch.dylib              0x1859a2a14 _dispatch_client_callout
16 libdispatch.dylib              0x1859de9c4 _dispatch_block_invoke_direct$VARIANT$armv81
17 libdispatch.dylib              0x1859a2a14 _dispatch_client_callout
18 libdispatch.dylib              0x1859de9c4 _dispatch_block_invoke_direct$VARIANT$armv81
19 libdispatch.dylib              0x1859de878 dispatch_block_perform$VARIANT$armv81
20 Foundation                     0x1869fb878 __NSOQSchedule_f
21 libdispatch.dylib              0x1859a2a14 _dispatch_client_callout
22 libdispatch.dylib              0x1859e3c80 _dispatch_main_queue_callback_4CF$VARIANT$armv81
23 CoreFoundation                 0x185fcb344 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
24 CoreFoundation                 0x185fc8f20 __CFRunLoopRun
25 CoreFoundation                 0x185ee8c58 CFRunLoopRunSpecific
26 GraphicsServices               0x187d94f84 GSEventRunModal
27 UIKit                          0x18f6415c4 UIApplicationMain
28 Holonis                        0x104071130 main (AppDelegate.swift:25)
29 libdyld.dylib                  0x185a0856c start

Which could possible be an Out of Memory problem. And we are having about 4% of our user base have OOM sessions.

We got this issue reported by Fabric couple of times. Any solution to avoid this ? or Need to be fixed in Kingfisher ?

Same for me

Same for me.

1  Kingfisher        0x101ff87f8 specialized ImageDownloaderSessionHandler.callCompletionHandlerFailure(error : Error, url : URL) -> () (ImageDownloader.swift:578)
2  Kingfisher        0x101ff9b4c specialized ImageDownloaderSessionHandler.urlSession(URLSession, task : URLSessionTask, didCompleteWithError : Error?) -> () (ImageDownloader.swift:528)
3  Kingfisher        0x101ff2268 @objc ImageDownloaderSessionHandler.urlSession(URLSession, task : URLSessionTask, didCompleteWithError : Error?) -> () (ImageDownloader.swift)

We have this same issue. Also Reported on Fabric

Crashed: com.apple.main-thread
0  libdispatch.dylib              0x182629788 _os_object_retain$VARIANT$armv81 + 64
1  Kingfisher                     0x1055b4194 specialized ImageDownloaderSessionHandler.callCompletionHandlerFailure(error:url:) (ImageDownloader.swift:525)
2  Kingfisher                     0x1055b5344 specialized ImageDownloaderSessionHandler.urlSession(_:task:didCompleteWithError:) (ImageDownloader.swift:475)
3  Kingfisher                     0x1055adf68 @objc ImageDownloaderSessionHandler.urlSession(_:task:didCompleteWithError:) (ImageDownloader.swift)
4  CFNetwork                      0x18345b990 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.207 + 76
5  Foundation                     0x18372ee88 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
6  Foundation                     0x1836708d0 -[NSBlockOperation main] + 72
7  Foundation                     0x18366fcac -[__NSOperationInternal _start:] + 848
8  libdispatch.dylib              0x1825f8a60 _dispatch_client_callout + 16
9  libdispatch.dylib              0x182634b2c _dispatch_block_invoke_direct$VARIANT$armv81 + 216
10 libdispatch.dylib              0x1825f8a60 _dispatch_client_callout + 16
11 libdispatch.dylib              0x182634b2c _dispatch_block_invoke_direct$VARIANT$armv81 + 216
12 libdispatch.dylib              0x182634a20 dispatch_block_perform$VARIANT$armv81 + 104
13 Foundation                     0x183730750 __NSOQSchedule_f + 376
14 libdispatch.dylib              0x1825f8a60 _dispatch_client_callout + 16
15 libdispatch.dylib              0x182639d80 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 964
16 CoreFoundation                 0x182caf070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
17 CoreFoundation                 0x182cacbc8 __CFRunLoopRun + 2272
18 CoreFoundation                 0x182bccda8 CFRunLoopRunSpecific + 552
19 GraphicsServices               0x184bb1020 GSEventRunModal + 100
20 UIKit                          0x18cbe9758 UIApplicationMain + 236
21 AppName                       0x10417ac38 main (AppDelegate.swift:14)
22 libdyld.dylib                  0x18265dfc0 start + 4

same

Fatal Exception: NSMallocException
0 CoreFoundation 0x184026d8c __exceptionPreprocess
1 libobjc.A.dylib 0x1831e05ec objc_exception_throw
2 Foundation 0x184a52d7c _NSErrnoMessage
3 CoreFoundation 0x183f85fd8 __CFSafelyReallocate
4 Foundation 0x1849b9b18 _NSMutableDataGrowBytes
5 Foundation 0x18497d74c -[NSConcreteMutableData appendBytes:length:]
6 Foundation 0x184bac5cc __49-[_NSDispatchData enumerateByteRangesUsingBlock:]_block_invoke
7 libdispatch.dylib 0x18397130c _dispatch_data_apply
8 Foundation 0x184bac594 -[_NSDispatchData enumerateByteRangesUsingBlock:]
9 Foundation 0x18499cc60 -[NSConcreteMutableData appendData:]
10 Kingfisher 0x103c014dc specialized ImageDownloaderSessionHandler.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data) -> () (ImageDownloader.swift:506)
11 Kingfisher 0x103bfa1bc @objc ImageDownloaderSessionHandler.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data) -> () (ImageDownloader.swift)
12 CFNetwork 0x18477c92c __67-[NSURLSession delegate_dataTask:didReceiveData:completionHandler:]_block_invoke.264
13 Foundation 0x184a4ee88 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
14 Foundation 0x1849908d0 -[NSBlockOperation main]
15 Foundation 0x18498fcac -[__NSOperationInternal _start:]
16 libdispatch.dylib 0x183918a60 _dispatch_client_callout
17 libdispatch.dylib 0x183954b2c _dispatch_block_invoke_direct$VARIANT$armv81
18 libdispatch.dylib 0x183918a60 _dispatch_client_callout
19 libdispatch.dylib 0x183954b2c _dispatch_block_invoke_direct$VARIANT$armv81
20 libdispatch.dylib 0x183954a20 dispatch_block_perform$VARIANT$armv81
21 Foundation 0x184a50750 __NSOQSchedule_f
22 libdispatch.dylib 0x183918a60 _dispatch_client_callout
23 libdispatch.dylib 0x183959d80 _dispatch_main_queue_callback_4CF$VARIANT$armv81
24 CoreFoundation 0x183fcf070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
25 CoreFoundation 0x183fccbc8 __CFRunLoopRun
26 CoreFoundation 0x183eecda8 CFRunLoopRunSpecific
27 GraphicsServices 0x185ed1020 GSEventRunModal
28 UIKit 0x18df09758 UIApplicationMain
29 syarahswift 0x1025d6854 main (AppDelegate.swift:47)
30 libdyld.dylib 0x18397dfc0 start

Got the same issue a lot from our users in Fabric, although personally I was never able to reproduce it.

My understanding is this EXC_BREAKPOINT happens when trying to access a nil object? But by checking the code, I don't see any where could lead to this error.

Probably like @onevcat has said, this could be an issue with semaphore.

@onevcat do you have any more thoughts about this issue? Do you think there could be a workaround for this? Like refactoring the code to not using semaphore? Since there is only one place using semaphore, I can try to get a PR together if that is OK.

Thanks.

#0Crashed: com.apple.main-thread EXC_BREAKPOINT 0x000000018339a63c

Crashed: com.apple.main-thread
0  libdispatch.dylib              0x18339a63c _os_object_retain$VARIANT$mp + 72
1  Kingfisher                     0x1020efe34 specialized ImageDownloaderSessionHandler.callCompletionHandlerFailure(error : Error, url : URL) -> () (ImageDownloader.swift:578)
2  Kingfisher                     0x1020f1188 specialized ImageDownloaderSessionHandler.urlSession(URLSession, task : URLSessionTask, didCompleteWithError : Error?) -> () (ImageDownloader.swift:528)
3  Kingfisher                     0x1020e98a4 @objc ImageDownloaderSessionHandler.urlSession(URLSession, task : URLSessionTask, didCompleteWithError : Error?) -> () (ImageDownloader.swift)
4  CFNetwork                      0x1841fb760 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.207 + 76
5  Foundation                     0x1844cee88 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
6  Foundation                     0x1844108d0 -[NSBlockOperation main] + 72
7  Foundation                     0x18440fcac -[__NSOperationInternal _start:] + 848
8  libdispatch.dylib              0x183398ae4 _dispatch_client_callout + 16
9  libdispatch.dylib              0x1833a01f4 _dispatch_block_invoke_direct$VARIANT$mp + 224
10 libdispatch.dylib              0x183398ae4 _dispatch_client_callout + 16
11 libdispatch.dylib              0x1833a01f4 _dispatch_block_invoke_direct$VARIANT$mp + 224
12 libdispatch.dylib              0x1833a00e0 dispatch_block_perform$VARIANT$mp + 104
13 Foundation                     0x1844d0750 __NSOQSchedule_f + 376
14 libdispatch.dylib              0x183398ae4 _dispatch_client_callout + 16
15 libdispatch.dylib              0x1833a56e0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1012
16 CoreFoundation                 0x183a4f070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
17 CoreFoundation                 0x183a4cbc8 __CFRunLoopRun + 2272
18 CoreFoundation                 0x18396cda8 CFRunLoopRunSpecific + 552
19 GraphicsServices               0x18594f020 GSEventRunModal + 100
20 UIKit                          0x18d94d78c UIApplicationMain + 236
21 Pla                            0x100c32918 main (AppDelegate.swift:23)
22 libdyld.dylib                  0x1833fdfc0 start + 4

Yes,

I am rewriting this part and try to remove the semaphore related code. I hope I could release the new version (and quite a few other refactoring) soon.

Having the same issue.

Fatal Exception: NSMallocException
0  CoreFoundation                 0x1e2a2fef8 __exceptionPreprocess
1  libobjc.A.dylib                0x1e1bfda40 objc_exception_throw
2  Foundation                     0x1e34c178c _NSInitializePlatform
3  CoreFoundation                 0x1e29621e8 __CFReallocationFailed
4  CoreFoundation                 0x1e2962188 __CFSafelyReallocate
5  Foundation                     0x1e34769f0 _NSMutableDataGrowBytes
6  Foundation                     0x1e33bec7c -[NSConcreteMutableData appendBytes:length:]
7  Foundation                     0x1e360a80c __49-[_NSDispatchData enumerateByteRangesUsingBlock:]_block_invoke
8  Foundation                     0x1e340ec28 -[_NSDispatchData enumerateByteRangesUsingBlock:]
9  Foundation                     0x1e3415340 -[NSConcreteMutableData appendData:]
10 Kingfisher                     0x1033fc464 $S10Kingfisher29ImageDownloaderSessionHandlerC03urlD0_8dataTask10didReceiveySo12NSURLSessionC_So0k4DataH0C10Foundation0L0VtFTf4dnnn_n (ImageDownloader.swift:522)
11 Kingfisher                     0x1033f55f4 $S10Kingfisher29ImageDownloaderSessionHandlerC03urlD0_8dataTask10didReceiveySo12NSURLSessionC_So0k4DataH0C10Foundation0L0VtFTo (<compiler-generated>)
12 CFNetwork                      0x1e31c7928 __67-[NSURLSession delegate_dataTask:didReceiveData:completionHandler:]_block_invoke.303
13 Foundation                     0x1e34bbb6c __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
14 Foundation                     0x1e33c3cc8 -[NSBlockOperation main]
15 Foundation                     0x1e33c319c -[__NSOperationInternal _start:]
16 Foundation                     0x1e34bda40 __NSOQSchedule_f
17 libdispatch.dylib              0x1e24151e0 _dispatch_block_async_invoke2
18 libdispatch.dylib              0x1e2468484 _dispatch_client_callout
19 libdispatch.dylib              0x1e24149ec _dispatch_main_queue_callback_4CF$VARIANT$mp
20 CoreFoundation                 0x1e29be1bc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
21 CoreFoundation                 0x1e29b9084 __CFRunLoopRun
22 CoreFoundation                 0x1e29b85b8 CFRunLoopRunSpecific
23 GraphicsServices               0x1e4c2c584 GSEventRunModal
24 UIKitCore                      0x20f5b0bc8 UIApplicationMain
25 XXXXXX                         0x102999ff4 main (UIFont+Extension.swift:14)
26 libdyld.dylib                  0x1e2478b94 start

This should be also related to #1001

Basically, these related issues should be already fixed in Kingfisher 5. I rewrote most of the code and introduced a more conservative way to handle memory cache. There is already a What's new in Kingfisher 5 article to describe the noticeable changes, as well as a migration guide.

The development for version 5 should be done now, and the beta version was already used in several of our products, with great response. So I recommend adapt to it soon!

I will tag and release it in a few hours.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iLucas97 picture iLucas97  Â·  5Comments

litt1e-p picture litt1e-p  Â·  4Comments

freak4pc picture freak4pc  Â·  3Comments

Minitour picture Minitour  Â·  4Comments

rainerjungwirth picture rainerjungwirth  Â·  4Comments