Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash in 3.8.0 and 3.8.1 from many users #1608

Closed
3 tasks done
romk1n opened this issue Jun 30, 2016 · 27 comments
Closed
3 tasks done

crash in 3.8.0 and 3.8.1 from many users #1608

romk1n opened this issue Jun 30, 2016 · 27 comments

Comments

@romk1n
Copy link

romk1n commented Jun 30, 2016

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
@smogun
Copy link

smogun commented Jun 30, 2016

We have also plenty of exactly the same crashes. It started to happen after updating to a version with NSURLSession

@romk1n
Copy link
Author

romk1n commented Jun 30, 2016

@smogun have you manage to reproduce it, I am wondering if that's relevant to the url query changes which were revered in 3.8.1 and if it fixes the crash?

@asenchuk
Copy link

asenchuk commented Jul 1, 2016

Confirm. After updating to 3.8.1 (from 3.7.6) getting lots of crashes with same reason:

Crashed: NSOperationQueue 0x144ff0570 :: NSOperation 0x14602c890 (QOS: LEGACY)
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000

Interesting that all crashes even don't have SDWebImage in the stack trace so found that ticket only after investigation what I updated since previous version so getting so many crashes. Don't think it's a coincidence.

@romk1n
Copy link
Author

romk1n commented Jul 1, 2016

i am just curios if it is safe to downgrade to 3.7.6

@romk1n romk1n changed the title crash in 3.8.0 from many users crash in 3.8.0 and 3.8.1 from many users Jul 1, 2016
@bsjcho
Copy link

bsjcho commented Jul 6, 2016

luckily I had this happen while I was debugging. here's the output of bt all. hopefully it's of some help.

warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.

  thread #1: tid = 0x10e731, 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8, queue = 'com.apple.main-thread'

    frame #0: 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8

    frame #1: 0x0000000188d731bc libsystem_kernel.dylib`mach_msg + 72

    frame #2: 0x00000001891ade64 CoreFoundation`__CFRunLoopServiceMachPort + 192

    frame #3: 0x00000001891aba80 CoreFoundation`__CFRunLoopRun + 1132

    frame #4: 0x00000001890de2e4 CoreFoundation`CFRunLoopRunSpecific + 292

    frame #5: 0x000000018aab715c GraphicsServices`GSEventRunModal + 180

    frame #6: 0x000000018eff26fc UIKit`-[UIApplication _run] + 692

    frame #7: 0x000000018efed438 UIKit`UIApplicationMain + 208

    frame #8: 0x000000010016f550 Project`main(argc=1, argv=0x000000016fd3ba18) + 124 at main.m:16

    frame #9: 0x0000000188c80600 libdyld.dylib`start + 4



  thread #3: tid = 0x10e782, 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #0: 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #1: 0x0000000188e52298 libsystem_pthread.dylib`_pthread_wqthread + 956

    frame #2: 0x0000000188e51ed0 libsystem_pthread.dylib`start_wqthread + 4



  thread #4: tid = 0x10e783, 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #0: 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #1: 0x0000000188e5247c libsystem_pthread.dylib`_pthread_wqthread + 1440

    frame #2: 0x0000000188e51ed0 libsystem_pthread.dylib`start_wqthread + 4



* thread #5: tid = 0x10e784, 0x000000018880aa50 libobjc.A.dylib`objc_msgSend + 16, queue = 'NSOperationQueue 0x174025e60 :: NSOperation 0x17425bc90 (QOS: LEGACY)', stop reason = EXC_BAD_ACCESS (code=1, address=0xcb1d0beb8)

    frame #0: 0x000000018880aa50 libobjc.A.dylib`objc_msgSend + 16

    frame #1: 0x0000000189976948 CFNetwork`-[NSURLCache cachedResponseForRequest:] + 124

  * frame #2: 0x0000000103711574 SDWebImage`-[SDWebImageDownloaderOperation URLSession:task:didCompleteWithError:](self=0x0000000170154530, _cmd="URLSession:task:didCompleteWithError:", session=0x00000001741d0c20, task=0x000000010971aae0, error=0x0000000000000000) + 748 at SDWebImageDownloaderOperation.m:407

    frame #3: 0x000000010370d8a0 SDWebImage`-[SDWebImageDownloader URLSession:task:didCompleteWithError:](self=0x00000001700ea400, _cmd="URLSession:task:didCompleteWithError:", session=0x00000001741d0c20, task=0x000000010971aae0, error=0x0000000000000000) + 184 at SDWebImageDownloader.m:306

    frame #4: 0x000000018996dee8 CFNetwork`__51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.185 + 72

    frame #5: 0x0000000189c58428 Foundation`__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16

    frame #6: 0x0000000189ba61ac Foundation`-[NSBlockOperation main] + 96

    frame #7: 0x0000000189b967a4 Foundation`-[__NSOperationInternal _start:] + 620

    frame #8: 0x0000000189c5a810 Foundation`__NSOQSchedule_f + 224

    frame #9: 0x0000000103ffd1d4 libdispatch.dylib`_dispatch_client_callout + 16

    frame #10: 0x000000010400ae70 libdispatch.dylib`_dispatch_queue_serial_drain + 1132

    frame #11: 0x0000000104000db8 libdispatch.dylib`_dispatch_queue_invoke + 744

    frame #12: 0x000000010400d058 libdispatch.dylib`_dispatch_root_queue_drain + 584

    frame #13: 0x000000010400cda8 libdispatch.dylib`_dispatch_worker_thread3 + 140

    frame #14: 0x0000000188e523d8 libsystem_pthread.dylib`_pthread_wqthread + 1276

    frame #15: 0x0000000188e51ed0 libsystem_pthread.dylib`start_wqthread + 4



  thread #6: tid = 0x10e785, 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #0: 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #1: 0x0000000188e5247c libsystem_pthread.dylib`_pthread_wqthread + 1440

    frame #2: 0x0000000188e51ed0 libsystem_pthread.dylib`start_wqthread + 4



  thread #7: tid = 0x10e786, 0x0000000103b78090 libswiftCore.dylib`@objc Swift._NSContiguousString._fastCharacterContents () -> Swift.UnsafeMutablePointer<Swift.UInt16>, queue = 'com.apple.NSURLSession-work'

    frame #0: 0x0000000103b78090 libswiftCore.dylib`@objc Swift._NSContiguousString._fastCharacterContents () -> Swift.UnsafeMutablePointer<Swift.UInt16>

    frame #1: 0x00000001890ec260 CoreFoundation`CFStringCompareWithOptionsAndLocale + 1620

    frame #2: 0x0000000189b99174 Foundation`-[NSString isEqualToString:] + 76

    frame #3: 0x0000000189b9910c Foundation`-[NSString isEqual:] + 68

    frame #4: 0x00000001890db94c CoreFoundation`CFEqual + 380

    frame #5: 0x00000001890dc904 CoreFoundation`CFBasicHashAddValue + 852

    frame #6: 0x00000001890dd8bc CoreFoundation`CFDictionaryAddValue + 256

    frame #7: 0x0000000189846394 CFNetwork`__CFURLCache::CreateAndStoreCacheNode(__CFURLCacheNode*, _CFCachedURLResponse const*, __CFString const*, _CFURLRequest const*, void const*, bool, bool&) + 724

    frame #8: 0x0000000189845ffc CFNetwork`__CFURLCache::AddCacheTask0(std::__1::unique_ptr<__CFURLCacheNode, std::__1::default_delete<__CFURLCacheNode> >&) + 472

    frame #9: 0x0000000189845df8 CFNetwork`__CFURLCache::AddCacheTask(std::__1::unique_ptr<__CFURLCacheNode, std::__1::default_delete<__CFURLCacheNode> >&) + 52

    frame #10: 0x00000001898480d8 CFNetwork`__CFURLCacheAddCachedResponseForRequestWithSession(_CFURLCache const*, NSURLSession const*, _CFCachedURLResponse const*, _CFURLRequest const*, void const*) + 732

    frame #11: 0x000000018987870c CFNetwork`__57-[__NSCFURLLocalSessionConnection afterDelegateWithTick:]_block_invoke + 72

    frame #12: 0x0000000103ffd214 libdispatch.dylib`_dispatch_call_block_and_release + 24

    frame #13: 0x0000000103ffd1d4 libdispatch.dylib`_dispatch_client_callout + 16

    frame #14: 0x000000010400ae70 libdispatch.dylib`_dispatch_queue_serial_drain + 1132

    frame #15: 0x0000000104000db8 libdispatch.dylib`_dispatch_queue_invoke + 744

    frame #16: 0x000000010400d058 libdispatch.dylib`_dispatch_root_queue_drain + 584

    frame #17: 0x000000010400cda8 libdispatch.dylib`_dispatch_worker_thread3 + 140

    frame #18: 0x0000000188e523d8 libsystem_pthread.dylib`_pthread_wqthread + 1276

    frame #19: 0x0000000188e51ed0 libsystem_pthread.dylib`start_wqthread + 4



  thread #9: tid = 0x10e791, 0x0000000188d912f0 libsystem_kernel.dylib`__semwait_signal + 8, name = 'gputools.smt_poll.0x174021b40'

    frame #0: 0x0000000188d912f0 libsystem_kernel.dylib`__semwait_signal + 8

    frame #1: 0x0000000188cb0774 libsystem_c.dylib`nanosleep + 212

    frame #2: 0x0000000188cb0694 libsystem_c.dylib`usleep + 64

    frame #3: 0x0000000104095874 GPUToolsCore`smt_poll_thread_entry(void*) + 136

    frame #4: 0x0000000188e549bc libsystem_pthread.dylib`_pthread_body + 240

    frame #5: 0x0000000188e548cc libsystem_pthread.dylib`_pthread_start + 276

    frame #6: 0x0000000188e51ed8 libsystem_pthread.dylib`thread_start + 4



  thread #10: tid = 0x10e794, 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.uikit.eventfetch-thread'

    frame #0: 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8

    frame #1: 0x0000000188d731bc libsystem_kernel.dylib`mach_msg + 72

    frame #2: 0x00000001891ade64 CoreFoundation`__CFRunLoopServiceMachPort + 192

    frame #3: 0x00000001891aba80 CoreFoundation`__CFRunLoopRun + 1132

    frame #4: 0x00000001890de2e4 CoreFoundation`CFRunLoopRunSpecific + 292

    frame #5: 0x0000000189b8893c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304

    frame #6: 0x0000000189ba9460 Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 96

    frame #7: 0x000000018f928134 UIKit`-[UIEventFetcher threadMain] + 136

    frame #8: 0x0000000189c73b9c Foundation`__NSThread__start__ + 1052

    frame #9: 0x0000000188e549bc libsystem_pthread.dylib`_pthread_body + 240

    frame #10: 0x0000000188e548cc libsystem_pthread.dylib`_pthread_start + 276

    frame #11: 0x0000000188e51ed8 libsystem_pthread.dylib`thread_start + 4



  thread #11: tid = 0x10e79c, 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.NSURLConnectionLoader'

    frame #0: 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8

    frame #1: 0x0000000188d731bc libsystem_kernel.dylib`mach_msg + 72

    frame #2: 0x00000001891ade64 CoreFoundation`__CFRunLoopServiceMachPort + 192

    frame #3: 0x00000001891aba80 CoreFoundation`__CFRunLoopRun + 1132

    frame #4: 0x00000001890de2e4 CoreFoundation`CFRunLoopRunSpecific + 292

    frame #5: 0x0000000189887a18 CFNetwork`+[NSURLConnection(Loader) _resourceLoadLoop:] + 336

    frame #6: 0x0000000189c73b9c Foundation`__NSThread__start__ + 1052

    frame #7: 0x0000000188e549bc libsystem_pthread.dylib`_pthread_body + 240

    frame #8: 0x0000000188e548cc libsystem_pthread.dylib`_pthread_start + 276

    frame #9: 0x0000000188e51ed8 libsystem_pthread.dylib`thread_start + 4



  thread #12: tid = 0x10e79f, 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.squareup.SocketRocket.NetworkThread'

    frame #0: 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8

    frame #1: 0x0000000188d731bc libsystem_kernel.dylib`mach_msg + 72

    frame #2: 0x00000001891ade64 CoreFoundation`__CFRunLoopServiceMachPort + 192

    frame #3: 0x00000001891aba80 CoreFoundation`__CFRunLoopRun + 1132

    frame #4: 0x00000001890de2e4 CoreFoundation`CFRunLoopRunSpecific + 292

    frame #5: 0x0000000189b8893c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304

    frame #6: 0x00000001038febf0 SocketRocket`-[_SRRunLoopThread main](self=0x00000001702893d0, _cmd="main") + 360 at SRWebSocket.m:1903

    frame #7: 0x0000000189c73b9c Foundation`__NSThread__start__ + 1052

    frame #8: 0x0000000188e549bc libsystem_pthread.dylib`_pthread_body + 240

    frame #9: 0x0000000188e548cc libsystem_pthread.dylib`_pthread_start + 276

    frame #10: 0x0000000188e51ed8 libsystem_pthread.dylib`thread_start + 4



  thread #13: tid = 0x10e7a0, 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.CoreMotion.MotionThread'

    frame #0: 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8

    frame #1: 0x0000000188d731bc libsystem_kernel.dylib`mach_msg + 72

    frame #2: 0x00000001891ade64 CoreFoundation`__CFRunLoopServiceMachPort + 192

    frame #3: 0x00000001891aba80 CoreFoundation`__CFRunLoopRun + 1132

    frame #4: 0x00000001890de2e4 CoreFoundation`CFRunLoopRunSpecific + 292

    frame #5: 0x000000018912b904 CoreFoundation`CFRunLoopRun + 112

    frame #6: 0x000000018fe030d4 CoreMotion`___lldb_unnamed_function2430$$CoreMotion + 824

    frame #7: 0x0000000188e549bc libsystem_pthread.dylib`_pthread_body + 240

    frame #8: 0x0000000188e548cc libsystem_pthread.dylib`_pthread_start + 276

    frame #9: 0x0000000188e51ed8 libsystem_pthread.dylib`thread_start + 4



  thread #14: tid = 0x10e7a1, 0x0000000188e51ecc libsystem_pthread.dylib`start_wqthread

    frame #0: 0x0000000188e51ecc libsystem_pthread.dylib`start_wqthread



  thread #15: tid = 0x10e7a2, 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8, name = 'AVAudioSession Notify Thread'

    frame #0: 0x0000000188d7334c libsystem_kernel.dylib`mach_msg_trap + 8

    frame #1: 0x0000000188d731bc libsystem_kernel.dylib`mach_msg + 72

    frame #2: 0x00000001891ade64 CoreFoundation`__CFRunLoopServiceMachPort + 192

    frame #3: 0x00000001891aba80 CoreFoundation`__CFRunLoopRun + 1132

    frame #4: 0x00000001890de2e4 CoreFoundation`CFRunLoopRunSpecific + 292

    frame #5: 0x00000001a24a8e60 AVFAudio`GenericRunLoopThread::Entry(void*) + 164

    frame #6: 0x00000001a24c6804 AVFAudio`CAPThread::Entry(CAPThread*) + 84

    frame #7: 0x0000000188e549bc libsystem_pthread.dylib`_pthread_body + 240

    frame #8: 0x0000000188e548cc libsystem_pthread.dylib`_pthread_start + 276

    frame #9: 0x0000000188e51ed8 libsystem_pthread.dylib`thread_start + 4



  thread #16: tid = 0x10e7a3, 0x0000000188d91218 libsystem_kernel.dylib`__select + 8, name = 'com.apple.CFSocket.private'

    frame #0: 0x0000000188d91218 libsystem_kernel.dylib`__select + 8

    frame #1: 0x00000001891b4d08 CoreFoundation`__CFSocketManager + 640

    frame #2: 0x0000000188e549bc libsystem_pthread.dylib`_pthread_body + 240

    frame #3: 0x0000000188e548cc libsystem_pthread.dylib`_pthread_start + 276

    frame #4: 0x0000000188e51ed8 libsystem_pthread.dylib`thread_start + 4



  thread #17: tid = 0x10e7a9, 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #0: 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #1: 0x0000000188e5247c libsystem_pthread.dylib`_pthread_wqthread + 1440

    frame #2: 0x0000000188e51ed0 libsystem_pthread.dylib`start_wqthread + 4



  thread #18: tid = 0x10e7ab, 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #0: 0x0000000188d91a88 libsystem_kernel.dylib`__workq_kernreturn + 8

    frame #1: 0x0000000188e5247c libsystem_pthread.dylib`_pthread_wqthread + 1440

    frame #2: 0x0000000188e51ed0 libsystem_pthread.dylib`start_wqthread + 4

@ryancrunchi
Copy link

ryancrunchi commented Jul 7, 2016

Same here from Fabric/Crashlytics for multiple users :

Crashed: NSOperationQueue 0x13f82c3d0 :: NSOperation 0x13e7a05c0 (QOS: LEGACY)
0  libobjc.A.dylib                0x182f8c0b0 objc_retain + 16
1  SDWebImage                     0x1005a1a6c -[SDWebImageDownloader URLSession:dataTask:willCacheResponse:completionHandler:] (SDWebImageDownloader.m:289)
2  Foundation                     0x1842c8540 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
3  Foundation                     0x18421a870 -[NSBlockOperation main] + 96
4  Foundation                     0x18420ae48 -[__NSOperationInternal _start:] + 604
5  Foundation                     0x1842ca934 __NSOQSchedule_f + 224
6  libdispatch.dylib              0x18335947c _dispatch_client_callout + 16
7  libdispatch.dylib              0x1833654c0 _dispatch_queue_drain + 864
8  libdispatch.dylib              0x18335cf80 _dispatch_queue_invoke + 464
9  libdispatch.dylib              0x183367390 _dispatch_root_queue_drain + 728
10 libdispatch.dylib              0x1833670b0 _dispatch_worker_thread3 + 112
11 libsystem_pthread.dylib        0x183571470 _pthread_wqthread + 1092
12 libsystem_pthread.dylib        0x183571020 start_wqthread + 4

--

#5. com.hackemist.SDWebImageCache
0  libsystem_kernel.dylib         0x183490724 mkdir + 8
1  Foundation                     0x18421451c __49-[NSFileManager _URLForReplacingItemAtURL:error:]_block_invoke + 44
2  Foundation                     0x184213efc -[NSFileManager _URLForReplacingItemAtURL:error:] + 1008
3  Foundation                     0x1842cd854 _NSCreateTemporaryFile_Protected + 500
4  Foundation                     0x184212fa8 _NSWriteDataToFileWithExtendedAttributes + 420
5  Foundation                     0x184299b50 -[NSFileManager createFileAtPath:contents:attributes:] + 84
6  SDWebImage                     0x10059c440 -[SDImageCache storeImageDataToDisk:forKey:] (SDImageCache.m:275)
7  SDWebImage                     0x10059c21c __72-[SDImageCache storeImage:recalculateFromImage:imageData:forKey:toDisk:]_block_invoke (SDImageCache.m:245)
8  libdispatch.dylib              0x1833594bc _dispatch_call_block_and_release + 24
9  libdispatch.dylib              0x18335947c _dispatch_client_callout + 16
10 libdispatch.dylib              0x1833654c0 _dispatch_queue_drain + 864
11 libdispatch.dylib              0x18335cf80 _dispatch_queue_invoke + 464
12 libdispatch.dylib              0x18335947c _dispatch_client_callout + 16
13 libdispatch.dylib              0x183367914 _dispatch_root_queue_drain + 2140
14 libdispatch.dylib              0x1833670b0 _dispatch_worker_thread3 + 112
15 libsystem_pthread.dylib        0x183571470 _pthread_wqthread + 1092
16 libsystem_pthread.dylib        0x183571020 start_wqthread + 4

#10. Crashed: NSOperationQueue 0x13f82c3d0 :: NSOperation 0x13e7a05c0 (QOS: LEGACY)
0  libobjc.A.dylib                0x182f8c0b0 objc_retain + 16
1  SDWebImage                     0x1005a1a6c -[SDWebImageDownloader URLSession:dataTask:willCacheResponse:completionHandler:] (SDWebImageDownloader.m:289)
2  Foundation                     0x1842c8540 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
3  Foundation                     0x18421a870 -[NSBlockOperation main] + 96
4  Foundation                     0x18420ae48 -[__NSOperationInternal _start:] + 604
5  Foundation                     0x1842ca934 __NSOQSchedule_f + 224
6  libdispatch.dylib              0x18335947c _dispatch_client_callout + 16
7  libdispatch.dylib              0x1833654c0 _dispatch_queue_drain + 864
8  libdispatch.dylib              0x18335cf80 _dispatch_queue_invoke + 464
9  libdispatch.dylib              0x183367390 _dispatch_root_queue_drain + 728
10 libdispatch.dylib              0x1833670b0 _dispatch_worker_thread3 + 112
11 libsystem_pthread.dylib        0x183571470 _pthread_wqthread + 1092
12 libsystem_pthread.dylib        0x183571020 start_wqthread + 4

@nitikorndev
Copy link

I have the same issues too.
screen shot 2016-07-07 at 6 03 28 pm

@bpoplauschi
Copy link
Member

I will look at this issue asap. Looks like more than an isolated issue

@alexisbronchart
Copy link

I'm also having this issue. Critical. Downgraded to 3.7.6.

@yshrkt
Copy link

yshrkt commented Jul 20, 2016

I got same issue too.
#1623 looks like same issue.

@GBoyadziev
Copy link

Same for me too. Next time it happens I will try to debug a bit and see if I can find out something useful.

@bestwnh
Copy link

bestwnh commented Aug 3, 2016

Hope anyone can try this #1623 (comment) , I just can't reproduce the crash by myself.

@nearllopez
Copy link

Hi guys,

Same problem (3.8.1)

Any updates about it?

Thanks!

@bpoplauschi
Copy link
Member

I will take a proper look at this issue this weekend.

@bpoplauschi bpoplauschi added this to the 3.8.2 milestone Aug 26, 2016
@bpoplauschi
Copy link
Member

I have spent some time trying to figure this out, but without success.
I'm currently at the state where I think it's related to NSURLCache and perhaps race conditioning there when one thread writes to the cache and this one reads. I'm on this thought path because I noticed in #1608 (comment) that on thread 7, the NSURLSession is writing stuff to the NSURLCache. I would be very curious if this is the case for other crashlogs as well. Could you (who use Fabric), just use the share option from Fabric so you can send me the link to the issue (I will be able to look at all the threads, iOS versions and other info).

@bpoplauschi
Copy link
Member

PS: @bsjcho thanks for the extra info

@eugene-manaev
Copy link

eugene-manaev commented Aug 29, 2016

@bpoplauschi Yes, of course. Use this link to see crash: http://crashes.to/s/ddb48c8cc47

@bpoplauschi
Copy link
Member

Many thanks @DarkDarius. It seems my assumption was wrong. In your crashlog, there is no other thread working with the NSURLCache - dead end here, will need a new hypothesis.

Another thing I tried was to pass nil to [[NSURLCache sharedURLCache] cachedResponseForRequest:] but it won't crash.

Another idea is that somehow, the NSURLRequest gets deallocated, but that makes little sense since the SDWebImageDownloaderOperation has a strong reference to the NSURLRequest.

@romk1n
Copy link
Author

romk1n commented Aug 29, 2016

@bpoplauschi here the one i found http://crashes.to/s/4af2fa1f4c7

@bpoplauschi
Copy link
Member

Thanks @romk1n

bpoplauschi added a commit that referenced this issue Sep 1, 2016
…id using the `_request` ivar and made sure we strip request of mutability
@bpoplauschi
Copy link
Member

Guys, I'm in a bit of dead-end here. I need help. I've added 1 commit on master with a small change, could you try it and see if the issue still occurs? Also, if anyone can reproduce the issue constantly, could you create a small demo project so I can debug it properly? (maybe @bsjcho)

Note: I was able to simulate the same crashlog by using a deallocated instance of NSURLRequest passed to [NSURLCache cachedResponseForRequest:], but I forced that. Not able to properly reproduce with the current code.

bpoplauschi added a commit that referenced this issue Sep 5, 2016
…e cases. Apparently there is a race condition on NSURLCache and we avoid making those checks unless necesarry (basically we will query the NSURLCache only when `SDWebImageRefreshCached` is used and the image cannot be cached by the system when it's too big or behind authentication)
@bpoplauschi
Copy link
Member

I have made an attempt fix in e7bd5ab: Apparently there is a race condition on NSURLCache and we avoid making those checks unless necessary (basically we will query the NSURLCache only when SDWebImageRefreshCached is used and the image cannot be cached by the system when it's too big or behind authentication). Will release a new version soon.

@bpoplauschi
Copy link
Member

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

@kaspermunck
Copy link

kaspermunck commented Oct 20, 2016

@bpoplauschi Did you file a radar on that race condition in NSURLCache (if yes, can you provide a link to it so I can dupe)? Recently we have received similar crash reports that seem to happen internally in NSURLCache -- not an SDWebImage issue, don't worry :-)

0  CFNetwork                      0x2480f0a4 __CFURLCache::checkMemoryCache(__CFString const*, _CFURLRequest const*, NSURLSession const*) + 139
1  libswiftCore.dylib             0x1a958f7 -[SwiftObject retain] + 10
2  CFNetwork                      0x2480cd49 __CFURLCache::CopyResponseForRequestWithCompletionHandler(_CFURLRequest const*, bool, NSURLSession const*, void (_CFCachedURLResponse const*) block_pointer) + 336
3  CFNetwork                      0x2480cf65 __CFURLCacheCopyResponseForRequest + 180
4  CFNetwork                      0x2480d7cd __CFURLCacheCopyResponseForRequestInternalWithSession(_CFURLCache const*, _CFURLRequest const*, unsigned char, NSURLSession const*) + 104
5  CFNetwork                      0x248c18b7 -[NSURLCache cachedResponseForRequest:] + 66

@bpoplauschi
Copy link
Member

@kaspermunck I did not create a radar, as I am not sure that is the cause. I'm waiting for people that had the issue and upgraded to comment back, if it's fixed. Basically, I only reduced the number of calls to NSURLCache

@kaspermunck
Copy link

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).

@bpoplauschi
Copy link
Member

Thanks to @zaczh, this issue will entirely go away in version 4.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests