Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crash ERROR_CGDataProvider_BufferIsNotReadable + 12, CGDataProviderRetainBytePtr + 216

I have a crash once in every 1000 to 2000 sessions in our app and I can't figure out what to do about it.

Is that an Apple iOS crash where I cant do anything about it?

I am using SDWebImage pod in my project, maybe it is that?

here is the crash log:

Thread 0 Crashed: 0  CoreGraphics                   0x182cfa59c ERROR_CGDataProvider_BufferIsNotReadable + 12 1   CoreGraphics                  0x000000018582e2c0 CGDataProviderRetainBytePtr + 216 2   QuartzCore                      0x0000000187f00048 CA::Render::(anonymous namespace)::create_image_from_image_data() + 196 3   QuartzCore                      0x0000000187efe1a0 CA::Render::create_image() + 900 4   QuartzCore                      0x0000000187f00e60 CA::Render::copy_image() + 472 5   QuartzCore                      0x0000000187f01228 CA::Render::prepare_image() + 20 6   QuartzCore                      0x00000001880101a8 CA::Layer::prepare_commit() + 332 7   QuartzCore                      0x0000000187f7245c CA::Context::commit_transaction() + 576 8   QuartzCore                      0x0000000187f99b90 CA::Transaction::commit() + 540 9   QuartzCore                      0x0000000187f9a9d0 CA::Transaction::observer_callback() + 92 9 10   CoreFoundation                  0x0000000183f65edc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32 11  CoreFoundation                  0x0000000183f63894 __CFRunLoopDoObservers + 412 12  CoreFoundation                  0x0000000183e83e78 CFRunLoopRunSpecific + 468 13  GraphicsServices                0x0000000185d30f84 GSEventRunModal + 100 14  UIKit                           0x000000018d50367c UIApplicationMain + 236 15  GOTit                           0x0000000100bb8e10 main (main.m:18) 16  libdyld.dylib                   0x00000001839a056c start + 4  - Full crash report:  Thread 1 name:  gputools.smt_poll.0x1c003bba0 Thread 1: 0   libsystem_kernel.dylib          0x00000001826c460c __semwait_signal + 8 1   libsystem_c.dylib               0x00000001825dce90 usleep + 64 2   GPUToolsCore                    0x0000000104b75f0c 3   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 4   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 5   libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 2 name:  gputools.smt_poll.0x1c003fa20 Thread 2: 0   libsystem_kernel.dylib          0x00000001826c460c __semwait_signal + 8 1   libsystem_c.dylib               0x00000001825dce90 usleep + 64 2   GPUToolsCore                    0x0000000104b75f0c 3   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 4   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 5   libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 3 name:  com.apple.uikit.eventfetch-thread Thread 3: 0   libsystem_kernel.dylib          0x00000001826a3568 mach_msg_trap + 8 1   CoreFoundation                  0x0000000182b5a308 __CFRunLoopServiceMachPort + 196 2   CoreFoundation                  0x0000000182b57ed4 __CFRunLoopRun + 1424 3   CoreFoundation                  0x0000000182a77e58 CFRunLoopRunSpecific + 436 4   Foundation                      0x00000001834ad594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 5   Foundation                      0x00000001834cc9ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 96 6   UIKit                           0x000000018cd367b8 -[UIEventFetcher threadMain] + 136 7   Foundation                      0x00000001835af0f4 __NSThread__start__ + 996 8   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 9   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 10  libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 4 name:  GAIThread Thread 4: 0   libsystem_kernel.dylib          0x00000001826a3568 mach_msg_trap + 8 1   CoreFoundation                  0x0000000182b5a308 __CFRunLoopServiceMachPort + 196 2   CoreFoundation                  0x0000000182b57ed4 __CFRunLoopRun + 1424 3   CoreFoundation                  0x0000000182a77e58 CFRunLoopRunSpecific + 436 4   Foundation                      0x00000001834ad594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 5   Foundation                      0x00000001834ff56c -[NSRunLoop(NSRunLoop) run] + 88 6   GOTit                           0x00000001033626fc 7   Foundation                      0x00000001835af0f4 __NSThread__start__ + 996 8   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 9   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 10  libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 5 name:  com.apple.NSURLConnectionLoader Thread 5: 0   libsystem_kernel.dylib          0x00000001826a3568 mach_msg_trap + 8 1   CoreFoundation                  0x0000000182b5a308 __CFRunLoopServiceMachPort + 196 2   CoreFoundation                  0x0000000182b57ed4 __CFRunLoopRun + 1424 3   CoreFoundation                  0x0000000182a77e58 CFRunLoopRunSpecific + 436 4   CFNetwork                       0x0000000183367128 -[__CoreSchedulingSetRunnable runForever] + 780 5   Foundation                      0x00000001835af0f4 __NSThread__start__ + 996 6   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 7   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 8   libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 6: 0   libsystem_kernel.dylib          0x00000001826a3568 mach_msg_trap + 8 1   CoreFoundation                  0x0000000182b5a308 __CFRunLoopServiceMachPort + 196 2   CoreFoundation                  0x0000000182b57ed4 __CFRunLoopRun + 1424 3   CoreFoundation                  0x0000000182a77e58 CFRunLoopRunSpecific + 436 4   GOTit                           0x00000001031af888 5   Foundation                      0x00000001835af0f4 __NSThread__start__ + 996 6   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 7   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 8   libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 7: 0   libsystem_kernel.dylib          0x00000001826c40f0 __psynch_cvwait + 8 1   libc++.1.dylib                  0x0000000181d7bea4 std::__1::condition_variable::wait() + 24 2   JavaScriptCore                  0x0000000189f1bf2c std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >() + 96 3   JavaScriptCore                  0x0000000189f1be54 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadRunLoop() + 172 4   JavaScriptCore                  0x0000000189f1c1b8 std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*), bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*> >() + 44 5   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 6   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 7   libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 8 name:  WebThread Thread 8: 0   libsystem_kernel.dylib          0x00000001826a3568 mach_msg_trap + 8 1   CoreFoundation                  0x0000000182b5a308 __CFRunLoopServiceMachPort + 196 2   CoreFoundation                  0x0000000182b57ed4 __CFRunLoopRun + 1424 3   CoreFoundation                  0x0000000182a77e58 CFRunLoopRunSpecific + 436 4   WebCore                         0x000000018a9e8a34 RunWebThread() + 560 5   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 6   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 7   libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 9: 0   libsystem_kernel.dylib          0x00000001826c460c __semwait_signal + 8 1   Foundation                      0x00000001835ae2a8 +[NSThread sleepForTimeInterval:] + 136 2   GOTit                           0x000000010316dd2c 3   Foundation                      0x00000001835af0f4 __NSThread__start__ + 996 4   libsystem_pthread.dylib         0x00000001827d82b4 _pthread_body + 308 5   libsystem_pthread.dylib         0x00000001827d8180 _pthread_body + 0 6   libsystem_pthread.dylib         0x00000001827d6b74 thread_start + 4   Thread 10: 0   libsystem_kernel.dylib          0x00000001826a35a4 semaphore_wait_trap + 8 1   libdispatch.dylib               0x0000000104a9dc0c 2   GOTit                           0x0000000102ba8290 3   GOTit                           0x0000000102ba8810 4   GOTit                           0x0000000102b135c8 5   GOTit                           0x00000001028c4888 6   libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 7   GOTit                           0x0000000102b13b8c 8   libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 9   GOTit                           0x0000000102b14be8 10  libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 11  GOTit                           0x0000000102a785c8 12  libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 13  GOTit                           0x0000000102a7cdbc 14  libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 15  GOTit                           0x0000000102b81444 16  libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 17  GOTit                           0x0000000102ba5354 18  libobjc.A.dylib                 0x0000000181df6ef4 object_cxxDestructFromClass() + 148 19  libobjc.A.dylib                 0x0000000181e04638 objc_destructInstance + 88 20  libobjc.A.dylib                 0x0000000181e04690 object_dispose + 16 21  GOTit                           0x0000000102bac7e8 22  CFNetwork                       0x00000001832edff4 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.207 + 76 23  Foundation                      0x0000000183589ba0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16 24  Foundation                      0x00000001834c9894 -[NSBlockOperation main] + 72 25  Foundation                      0x00000001834b94c4 -[__NSOperationInternal _start:] + 848 26  libdispatch.dylib               0x0000000104a9528c 27  libdispatch.dylib               0x0000000104aa19e4 28  libdispatch.dylib               0x0000000104a9528c 29  libdispatch.dylib               0x0000000104aa19e4 30  libdispatch.dylib               0x0000000104aa18a4 31  Foundation                      0x000000018358b878 __NSOQSchedule_f + 376 32  libdispatch.dylib               0x0000000104a9528c 33  libdispatch.dylib               0x0000000104aa2678 34  libdispatch.dylib               0x0000000104aa0f08 35  libdispatch.dylib               0x0000000104aa69d0 36  libdispatch.dylib               0x0000000104aa66f4 37  libsystem_pthread.dylib         0x00000001827d706c _pthread_wqthread + 1268 38  libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 11: 0   libsystem_kernel.dylib          0x00000001826a35a4 semaphore_wait_trap + 8 1   libdispatch.dylib               0x0000000104a9dc0c 2   GOTit                           0x0000000102ba8290 3   GOTit                           0x0000000102ba8810 4   GOTit                           0x0000000102b135c8 5   GOTit                           0x00000001028c4888 6   libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 7   GOTit                           0x0000000102b13b8c 8   libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 9   GOTit                           0x0000000102b14be8 10  libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 11  GOTit                           0x0000000102a785c8 12  libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 13  GOTit                           0x0000000102a7cdbc 14  libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 15  GOTit                           0x0000000102b81444 16  libsystem_blocks.dylib          0x00000001825cfa60 _Block_release + 160 17  GOTit                           0x0000000102ba5354 18  libobjc.A.dylib                 0x0000000181df6ef4 object_cxxDestructFromClass() + 148 19  libobjc.A.dylib                 0x0000000181e04638 objc_destructInstance + 88 20  libobjc.A.dylib                 0x0000000181e04690 object_dispose + 16 21  GOTit                           0x0000000102bac7e8 22  CFNetwork                       0x00000001832edff4 __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.207 + 76 23  Foundation                      0x0000000183589ba0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16 24  Foundation                      0x00000001834c9894 -[NSBlockOperation main] + 72 25  Foundation                      0x00000001834b94c4 -[__NSOperationInternal _start:] + 848 26  libdispatch.dylib               0x0000000104a9528c 27  libdispatch.dylib               0x0000000104aa19e4 28  libdispatch.dylib               0x0000000104a9528c 29  libdispatch.dylib               0x0000000104aa19e4 30  libdispatch.dylib               0x0000000104aa18a4 31  Foundation                      0x000000018358b878 __NSOQSchedule_f + 376 32  libdispatch.dylib               0x0000000104a9528c 33  libdispatch.dylib               0x0000000104aa2678 34  libdispatch.dylib               0x0000000104aa0f08 35  libdispatch.dylib               0x0000000104aa69d0 36  libdispatch.dylib               0x0000000104aa66f4 37  libsystem_pthread.dylib         0x00000001827d706c _pthread_wqthread + 1268 38  libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 12: 0   libsystem_pthread.dylib         0x00000001827d6b68 start_wqthread + 0   Thread 13: 0   libsystem_pthread.dylib         0x00000001827d6b68 start_wqthread + 0   Thread 14: 0   libobjc.A.dylib                 0x0000000181e04614 objc_destructInstance + 52 1   libdispatch.dylib               0x0000000104a98f04 2   libdispatch.dylib               0x0000000104a972a0 3   libdispatch.dylib               0x0000000104aa3d9c 4   libdispatch.dylib               0x0000000104a987ec 5   libdispatch.dylib               0x0000000104aa4f6c 6   libdispatch.dylib               0x0000000104aac020 7   libsystem_pthread.dylib         0x00000001827d6f1c _pthread_wqthread + 932 8   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 15: 0   libsystem_kernel.dylib          0x00000001826c4d80 __workq_kernreturn + 8 1   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 16: 0   libsystem_kernel.dylib          0x00000001826c460c __semwait_signal + 8 1   libsystem_c.dylib               0x0000000182645f34 sleep + 44 2   GOTit                           0x00000001028c21f4 3   libdispatch.dylib               0x0000000104a952cc 4   libdispatch.dylib               0x0000000104a9528c 5   libdispatch.dylib               0x0000000104aa3f80 6   libdispatch.dylib               0x0000000104a987ec 7   libdispatch.dylib               0x0000000104aa4f6c 8   libdispatch.dylib               0x0000000104aac020 9   libsystem_pthread.dylib         0x00000001827d6f1c _pthread_wqthread + 932 10  libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 17: 0   libsystem_kernel.dylib          0x00000001826c4d80 __workq_kernreturn + 8 1   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 18: 0   libsystem_kernel.dylib          0x00000001826c460c __semwait_signal + 8 1   libsystem_c.dylib               0x0000000182645f34 sleep + 44 2   GOTit                           0x00000001028c21f4 3   libdispatch.dylib               0x0000000104a952cc 4   libdispatch.dylib               0x0000000104a9528c 5   libdispatch.dylib               0x0000000104aa3f80 6   libdispatch.dylib               0x0000000104a987ec 7   libdispatch.dylib               0x0000000104aa4f6c 8   libdispatch.dylib               0x0000000104aac020 9   libsystem_pthread.dylib         0x00000001827d6f1c _pthread_wqthread + 932 10  libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 19: 0   libsystem_pthread.dylib         0x00000001827d6b68 start_wqthread + 0   Thread 20: 0   libsystem_kernel.dylib          0x00000001826c460c __semwait_signal + 8 1   libsystem_c.dylib               0x0000000182645f34 sleep + 44 2   GOTit                           0x00000001028c21f4 3   libdispatch.dylib               0x0000000104a952cc 4   libdispatch.dylib               0x0000000104a9528c 5   libdispatch.dylib               0x0000000104aa3f80 6   libdispatch.dylib               0x0000000104a987ec 7   libdispatch.dylib               0x0000000104aa4f6c 8   libdispatch.dylib               0x0000000104aac020 9   libsystem_pthread.dylib         0x00000001827d6f1c _pthread_wqthread + 932 10  libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 21: 0   libsystem_kernel.dylib          0x00000001826c4d80 __workq_kernreturn + 8 1   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 22: 0   libsystem_kernel.dylib          0x00000001826c3e5c __open + 8 1   Foundation                      0x00000001834c6be8 _NSReadBytesFromFileWithExtendedAttributes + 132 2   Foundation                      0x00000001835405a8 -[NSData(NSData) initWithContentsOfFile:options:maxLength:error:] + 184 3   Foundation                      0x00000001834cb6ec +[NSData(NSData) dataWithContentsOfFile:options:error:] + 68 4   GOTit                           0x0000000102f181dc 5   GOTit                           0x0000000102f18780 6   GOTit                           0x0000000102f18eb0 7   libdispatch.dylib               0x0000000104a952cc 8   libdispatch.dylib               0x0000000104a9528c 9   libdispatch.dylib               0x0000000104aa3f80 10  libdispatch.dylib               0x0000000104a987ec 11  libdispatch.dylib               0x0000000104aa4f6c 12  libdispatch.dylib               0x0000000104aac020 13  libsystem_pthread.dylib         0x00000001827d6f1c _pthread_wqthread + 932 14  libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 23: 0   libsystem_kernel.dylib          0x00000001826c4d80 __workq_kernreturn + 8 1   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 24: 0   libsystem_pthread.dylib         0x00000001827d6b68 start_wqthread + 0   Thread 25: 0   libsystem_kernel.dylib          0x00000001826c4d80 __workq_kernreturn + 8 1   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 26: 0   libsystem_kernel.dylib          0x00000001826c4d80 __workq_kernreturn + 8 1   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 27: 0   libsystem_pthread.dylib         0x00000001827d6b68 start_wqthread + 0   Thread 28: 0   libsystem_pthread.dylib         0x00000001827d6b68 start_wqthread + 0   Thread 29: 0   libsystem_kernel.dylib          0x00000001826c4d80 __workq_kernreturn + 8 1   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4   Thread 30: 0   libsystem_kernel.dylib          0x00000001826c4d80 __workq_kernreturn + 8 1   libsystem_pthread.dylib         0x00000001827d6b6c start_wqthread + 4 
like image 481
Refael.S Avatar asked Jan 12 '18 00:01

Refael.S


2 Answers

I'm getting the same thing. Here's some additional info.

This crash happens after my app captures an image, crops it, and rescales it.

The crash info showed that the user only had 6% memory available.

I suspect that something in my image processing pipeline fails silently, possibly due to running out of memory, and then produces a corrupt UIImage. Then when I try to draw it it crashes.

In my case I added a bunch of guards and logging statements so that when the crash happens again I'll hopefully get more info and be able to post a workaround.

like image 156
Chris Garrett Avatar answered Sep 30 '22 15:09

Chris Garrett


@chris-garrett pointed me in the right direction and I was able to greatly mitigate the issue by fixing memory leaks.

Users who are now getting this error are people who spend at least 30 minutes on the app, which is pretty uncommon. Also, the fact that it affects mostly big screens like iPhone 7/6s/8 Plus, iPhone X, where more memory is needed to render images would corroborate that theory


What you should do to solve this, is to check the memory while debugging. If it increases gradually when repeating the same actions, there's certainly something for you to fix.

enter image description here

There are many ways to find leaks in your app, I'm not a big fan of Instruments, but you can find many tutorials online if needed. Another option is to use memory graph. I wrote previously an article on how to use memory graph here.

like image 21
streem Avatar answered Sep 30 '22 15:09

streem