SDWebImage: crash in 3.8.0 and 3.8.1 from many users

New Issue Checklist

Issue Info

Info Value
Platform Name ios
Platform Version 8.0
SDWebImage Version 3.8.0
Integration Method cocoapods
Xcode Version e.g. Xcode 7.3.1
Repro rate not clear from crash reports
Repro with our demo prj n/a
Demo project link n/a

Issue Description and Steps

We have Fabric reporting a lot of the crashes

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, …) and the steps to reproduce the issue.

Crashed: NSOperationQueue 0x145699b0 :: NSOperation 0x145c13c0 (QOS: LEGACY)
0  libobjc.A.dylib                0x2393fa66 objc_msgSend + 5
1  CFNetwork                      0x2478877f -[NSURLCache cachedResponseForRequest:] + 114
2  SDWebImage                     0x23bd795 -[SDWebImageDownloaderOperation URLSession:task:didCompleteWithError:] (SDWebImageDownloaderOperation.m:407)
3  SDWebImage                     0x23bb7f3 -[SDWebImageDownloader URLSession:task:didCompleteWithError:] (SDWebImageDownloader.m:306)
4  CFNetwork                      0x24781505 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke170 + 76
5  Foundation                     0x249a9679 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 8
6  Foundation                     0x2490a5f3 -[NSBlockOperation main] + 146
7  Foundation                     0x248fcbc9 -[__NSOperationInternal _start:] + 768
8  Foundation                     0x249ab931 __NSOQSchedule_f + 192
9  libdispatch.dylib              0x23d12423 _dispatch_queue_drain$VARIANT$mp + 1758
10 libdispatch.dylib              0x23d11a61 _dispatch_queue_invoke$VARIANT$mp + 284
11 libdispatch.dylib              0x23d1415d _dispatch_root_queue_drain + 396
12 libdispatch.dylib              0x23d13fcd _dispatch_worker_thread3 + 96
13 libsystem_pthread.dylib        0x23ec9b29 _pthread_wqthread + 1024
14 libsystem_pthread.dylib        0x23ec9718 start_wqthread + 8

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 13
  • Comments: 27 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Guys, 3.8.2 is now available via CocoaPods, please try it out and let me know if the issue still happens or not.

Dug a little deeper (i.e. actually studied the documentation of NSURLCache) and unfortunately it looks like the race condition is expected in certain cases (read more here).