ERROR_CGDataProvider_BufferIsNotReadable crash

Hi there,


Our app is getting crash related to ERROR_CGDataProvider_BufferIsNotReadable and it is only happen on iOS 11. Any idea how to fix this? We have been searching around but could not find anything related to it. Thanks in advance.


Full crash report posted below:


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

0 CoreGraphics 0x182cfa59c ERROR_CGDataProvider_BufferIsNotReadable + 12

1 CoreGraphics 0x182cfa2c0 CGDataProviderRetainBytePtr + 216

2 QuartzCore 0x1853cc048 CA::Render::(anonymous namespace)::create_image_from_image_data(CGImage*, CGColorSpace*, unsigned int, unsigned int, double) + 196

3 QuartzCore 0x1853ca1a0 CA::Render::create_image(CGImage*, CGColorSpace*, unsigned int, double) + 900

4 QuartzCore 0x1853cce60 CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double, double) + 472

5 QuartzCore 0x1853cd228 CA::Render::prepare_image(CGImage*, CGColorSpace*, unsigned int, double) + 20

6 QuartzCore 0x1854dc1a8 CA::Layer::prepare_commit(CA::Transaction*) + 332

7 QuartzCore 0x18543e45c CA::Context::commit_transaction(CA::Transaction*) + 576

8 QuartzCore 0x185465b90 CA::Transaction::commit() + 540

9 QuartzCore 0x1854669d0 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92

10 CoreFoundation 0x181431edc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32

11 CoreFoundation 0x18142f894 __CFRunLoopDoObservers + 412

12 CoreFoundation 0x18142fe50 __CFRunLoopRun + 1292

13 CoreFoundation 0x18134fe58 CFRunLoopRunSpecific + 436

14 GraphicsServices 0x1831fcf84 GSEventRunModal + 100

15 UIKit 0x18a9cf67c UIApplicationMain + 236

16 Supers 0x10469c320 main (main.m:20)

17 libdyld.dylib 0x180e6c56c start + 4



--



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

0 CoreGraphics 0x182cfa59c ERROR_CGDataProvider_BufferIsNotReadable + 12

1 CoreGraphics 0x182cfa2c0 CGDataProviderRetainBytePtr + 216

2 QuartzCore 0x1853cc048 CA::Render::(anonymous namespace)::create_image_from_image_data(CGImage*, CGColorSpace*, unsigned int, unsigned int, double) + 196

3 QuartzCore 0x1853ca1a0 CA::Render::create_image(CGImage*, CGColorSpace*, unsigned int, double) + 900

4 QuartzCore 0x1853cce60 CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double, double) + 472

5 QuartzCore 0x1853cd228 CA::Render::prepare_image(CGImage*, CGColorSpace*, unsigned int, double) + 20

6 QuartzCore 0x1854dc1a8 CA::Layer::prepare_commit(CA::Transaction*) + 332

7 QuartzCore 0x18543e45c CA::Context::commit_transaction(CA::Transaction*) + 576

8 QuartzCore 0x185465b90 CA::Transaction::commit() + 540

9 QuartzCore 0x1854669d0 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92

10 CoreFoundation 0x181431edc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32

11 CoreFoundation 0x18142f894 __CFRunLoopDoObservers + 412

12 CoreFoundation 0x18142fe50 __CFRunLoopRun + 1292

13 CoreFoundation 0x18134fe58 CFRunLoopRunSpecific + 436

14 GraphicsServices 0x1831fcf84 GSEventRunModal + 100

15 UIKit 0x18a9cf67c UIApplicationMain + 236

16 Supers 0x10469c320 main (main.m:20)

17 libdyld.dylib 0x180e6c56c start + 4



#1. com.apple.uikit.eventfetch-thread

0 libsystem_kernel.dylib 0x180f7b568 mach_msg_trap + 8

1 libsystem_kernel.dylib 0x180f7b3e0 mach_msg + 72

2 CoreFoundation 0x181432308 __CFRunLoopServiceMachPort + 196

3 CoreFoundation 0x18142fed4 __CFRunLoopRun + 1424

4 CoreFoundation 0x18134fe58 CFRunLoopRunSpecific + 436

5 Foundation 0x181d85594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304

6 Foundation 0x181da49ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 96

7 UIKit 0x18b5397b8 -[UIEventFetcher threadMain] + 136

8 Foundation 0x181e870f4 __NSThread__start__ + 996

9 libsystem_pthread.dylib 0x1810b02b4 _pthread_body + 308

10 libsystem_pthread.dylib 0x1810b0180 _pthread_body + 310

11 libsystem_pthread.dylib 0x1810aeb74 thread_start + 4



#2. com.twitter.crashlytics.ios.MachExceptionServer

0 Supers 0x104ae0eb8 CLSProcessRecordAllThreads (CLSProcess.c:376)

1 Supers 0x104ae0eb8 CLSProcessRecordAllThreads (CLSProcess.c:376)

2 Supers 0x104ae0d68 CLSProcessRecordAllThreads (CLSProcess.c:407)

3 Supers 0x104ad07b0 CLSHandler (CLSHandler.m:26)

4 Supers 0x104acb420 CLSMachExceptionServer (CLSMachException.c:446)

5 libsystem_pthread.dylib 0x1810b02b4 _pthread_body + 308

6 libsystem_pthread.dylib 0x1810b0180 _pthread_body + 310

7 libsystem_pthread.dylib 0x1810aeb74 thread_start + 4



#3. AFNetworking

0 libsystem_kernel.dylib 0x180f7b568 mach_msg_trap + 8

1 libsystem_kernel.dylib 0x180f7b3e0 mach_msg + 72

2 CoreFoundation 0x181432308 __CFRunLoopServiceMachPort + 196

3 CoreFoundation 0x18142fed4 __CFRunLoopRun + 1424

4 CoreFoundation 0x18134fe58 CFRunLoopRunSpecific + 436

5 Foundation 0x181d85594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304

6 Foundation 0x181dd756c -[NSRunLoop(NSRunLoop) run] + 88

7 Supers 0x10477b0d8 +[AFURLConnectionOperation networkRequestThreadEntryPoint:] (AFURLConnectionOperation.m:164)

8 Foundation 0x181e870f4 __NSThread__start__ + 996

9 libsystem_pthread.dylib 0x1810b02b4 _pthread_body + 308

10 libsystem_pthread.dylib 0x1810b0180 _pthread_body + 310

11 libsystem_pthread.dylib 0x1810aeb74 thread_start + 4



#4. GAIThread

0 libsystem_kernel.dylib 0x180f7b568 mach_msg_trap + 8

1 libsystem_kernel.dylib 0x180f7b3e0 mach_msg + 72

2 CoreFoundation 0x181432308 __CFRunLoopServiceMachPort + 196

3 CoreFoundation 0x18142fed4 __CFRunLoopRun + 1424

4 CoreFoundation 0x18134fe58 CFRunLoopRunSpecific + 436

5 Foundation 0x181d85594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304

6 Foundation 0x181dd756c -[NSRunLoop(NSRunLoop) run] + 88

7 Supers 0x104845e1c +[GAI threadMain:] (GAI.m:229)

8 Foundation 0x181e870f4 __NSThread__start__ + 996

9 libsystem_pthread.dylib 0x1810b02b4 _pthread_body + 308

10 libsystem_pthread.dylib 0x1810b0180 _pthread_body + 310

11 libsystem_pthread.dylib 0x1810aeb74 thread_start + 4



#5. com.apple.NSURLConnectionLoader

0 libsystem_kernel.dylib 0x180f7b568 mach_msg_trap + 8

1 libsystem_kernel.dylib 0x180f7b3e0 mach_msg + 72

2 CoreFoundation 0x181432308 __CFRunLoopServiceMachPort + 196

3 CoreFoundation 0x18142fed4 __CFRunLoopRun + 1424

4 CoreFoundation 0x18134fe58 CFRunLoopRunSpecific + 436

5 CFNetwork 0x181c3f128 -[__CoreSchedulingSetRunnable runForever] + 780

6 Foundation 0x181e870f4 __NSThread__start__ + 996

7 libsystem_pthread.dylib 0x1810b02b4 _pthread_body + 308

8 libsystem_pthread.dylib 0x1810b0180 _pthread_body + 310

9 libsystem_pthread.dylib 0x1810aeb74 thread_start + 4



#6. Thread

0 libsystem_pthread.dylib 0x1810aeb68 start_wqthread + 122



#7. com.appdynamics.EumInstrumentation.Database

0 libsystem_kernel.dylib 0x180f7d860 fsync + 8

1 libsqlite3.dylib 0x1818ef828 (null) + 59100

2 libsqlite3.dylib 0x1818ef0dc (null) + 57232

3 libsqlite3.dylib 0x1818db9ec (null) + 21904

4 libsqlite3.dylib 0x1818a9288 (null) + 3472

5 libsqlite3.dylib 0x1818d5148 (null) + 62464

6 libsqlite3.dylib 0x1818c67dc sqlite3_step + 2708

7 libsqlite3.dylib 0x181890c74 sqlite3_exec + 536

8 Supers 0x104ac5bb0 +[ADEumEventCounterStore updateEventCounter:] (ADEumEventCounterStore.m:33)

9 Supers 0x104ab0408 __37-[ADEumSqliteHelper deleteWithQuery:]_block_invoke (ADEumSqliteHelper.m:55)

10 libdispatch.dylib 0x180e06a14 _dispatch_client_callout + 16

11 libdispatch.dylib 0x180e43d4c _dispatch_queue_barrier_sync_invoke_and_complete + 56

12 Supers 0x104ab0208 -[ADEumSqliteHelper deleteWithQuery:] (ADEumSqliteHelper.m:205)

13 Supers 0x104aaecac -[ADEumBeaconPersistenceStore dropBeacons] (ADEumBeaconPersistenceStore.m:56)

14 Supers 0x104ab7078 -[ADEumBeaconDispatcher loadBeaconsFromPersistence] (ADEumBeaconDispatcher.m:204)

15 Supers 0x104ab68f4 __49-[ADEumBeaconDispatcher flushPendingBeaconsPlus:]_block_invoke (ADEumBeaconDispatcher.m:113)

16 libdispatch.dylib 0x180e06a54 _dispatch_call_block_and_release + 24

17 libdispatch.dylib 0x180e06a14 _dispatch_client_callout + 16

18 libdispatch.dylib 0x180e4504c _dispatch_queue_serial_drain$VARIANT$armv81 + 520

19 libdispatch.dylib 0x180e459bc _dispatch_queue_invoke$VARIANT$armv81 + 340

20 libdispatch.dylib 0x180e463a8 _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 384

21 libdispatch.dylib 0x180e4e4b0 _dispatch_workloop_worker_thread$VARIANT$armv81 + 640

22 libsystem_pthread.dylib 0x1810aef1c _pthread_wqthread + 932

23 libsystem_pthread.dylib 0x1810aeb6c start_wqthread + 4



#8. Thread

0 libsystem_kernel.dylib 0x180f9cd80 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x1810aeeec _pthread_wqthread + 884

2 libsystem_pthread.dylib 0x1810aeb6c start_wqthread + 4



#9. Thread

0 libsystem_pthread.dylib 0x1810aeb68 start_wqthread + 122



#10. Thread

0 libsystem_kernel.dylib 0x180f9cd80 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x1810aeeec _pthread_wqthread + 884

2 libsystem_pthread.dylib 0x1810aeb6c start_wqthread + 4



#11. Thread

0 libsystem_kernel.dylib 0x180f9cd80 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x1810aeeec _pthread_wqthread + 884

2 libsystem_pthread.dylib 0x1810aeb6c start_wqthread + 4



#12. Thread

0 libsystem_kernel.dylib 0x180f9cd80 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x1810af080 _pthread_wqthread + 1288

2 libsystem_pthread.dylib 0x1810aeb6c start_wqthread + 4



#13. Thread

0 libsystem_kernel.dylib 0x180f9cd80 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x1810af080 _pthread_wqthread + 1288

2 libsystem_pthread.dylib 0x1810aeb6c start_wqthread + 4



#14. Thread

0 libsystem_kernel.dylib 0x180f9cd80 __workq_kernreturn + 8

1 libsystem_pthread.dylib 0x1810af080 _pthread_wqthread + 1288

2 libsystem_pthread.dylib 0x1810aeb6c start_wqthread + 4



#15. Thread

0 libsystem_pthread.dylib 0x1810aeb68 start_wqthread + 122

We're also finding this a lot in Crashlytics for 11.2.x (ONLY).


If you click "View all sessions", do you see a lot of "613: CFNetwork internal error" keys? I have a feeling this is related to fetching image data when network connectivity isn't that great.


We are using Xcode 9.2 and also SDWebImage in a rather image-heavy app. I have yet to reproduce this (nor our QA team). It's not terribly often this happens, but we'd sure like to know why and how to avoid it.

I'm receiving reports of this error still on 11.2.5 specifically from 7 Plus.


The code that fails:


extension UIImage {
    func renderResizedImage (newWidth: CGFloat) -> UIImage? {
        let scale = newWidth / self.size.width
        let newHeight = self.size.height * scale
        let newSize = CGSize(width: newWidth, height: newHeight)
     
        let renderer = UIGraphicsImageRenderer(size: newSize)
     
        let image = renderer.image { (context) in
            self.draw(in: CGRect(origin: CGPoint(x: 0, y: 0), size: newSize))
        }
        return image
    }
}


Line 10 produces error with the following stack trace (line UIImage+.swift:51 represents line 10 from the above code listing):


#1. Crashed: photo processing queue

0 CoreGraphics 0x18422a59c ERROR_CGDataProvider_BufferIsNotReadable + 12

1 CoreGraphics 0x18422a2c0 CGDataProviderRetainBytePtr + 216

2 CoreGraphics 0x18431d06c get_image_pointer + 64

3 CoreGraphics 0x18431d2c8 img_raw_access + 52

4 CoreGraphics 0x184318000 img_interpolate_read + 708

5 CoreGraphics 0x18431c14c img_data_lock + 7048

6 CoreGraphics 0x18431a56c CGSImageDataLock + 184

7 CoreGraphics 0x18413a628 ripc_AcquireRIPImageData + 308

8 CoreGraphics 0x18432f1b0 ripc_DrawImage + 644

9 CoreGraphics 0x18431efac CGContextDrawImageWithOptions + 632

10 UIKit 0x18bf81fac -[UIImage drawInRect:blendMode:alpha:] + 1816

11 Magic ViewFinder IOS 0x100adcc68 partial apply for UIImage.(renderResizedImage(newWidth : CGFloat) -> UIImage?).(closure #1) (UIImage+.swift:51)

12 Magic ViewFinder IOS 0x100ac3ba4 thunk (SmartImageRenderer.swift)

13 UIKit 0x18c62bd48 -[UIGraphicsRenderer runDrawingActions:completionActions:format:error:] + 452

14 UIKit 0x18c62bb50 -[UIGraphicsRenderer runDrawingActions:completionActions:error:] + 120

15 UIKit 0x18c9c8184 -[UIGraphicsImageRenderer imageWithActions:] + 152

16 Magic ViewFinder IOS 0x100adc864 UIImage.renderResizedImage(newWidth : CGFloat) -> UIImage? (UIImage+.swift:52)

17 Magic ViewFinder IOS 0x100ac2ed8 specialized CameraHelper.(photoOutput(AVCapturePhotoOutput, didFinishCaptureFor : AVCaptureResolvedPhotoSettings, error : Error?) -> ()).(closure #1) (CameraHelper.swift:862)

18 Magic ViewFinder IOS 0x100ac37b4 partial apply for CameraHelper.(photoOutput(AVCapturePhotoOutput, didFinishCaptureFor : AVCaptureResolvedPhotoSettings, error : Error?) -> ()).(closure #1) (CameraHelper.swift)

19 Magic ViewFinder IOS 0x100aa970c thunk (ViewController.swift)

20 libdispatch.dylib 0x182336a54 _dispatch_call_block_and_release + 24

21 libdispatch.dylib 0x182336a14 _dispatch_client_callout + 16

22 libdispatch.dylib 0x18234096c _dispatch_queue_serial_drain$VARIANT$mp + 528

23 libdispatch.dylib 0x1823412fc _dispatch_queue_invoke$VARIANT$mp + 340

24 libdispatch.dylib 0x182341d20 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 404

25 libdispatch.dylib 0x18234a03c _dispatch_workloop_worker_thread$VARIANT$mp + 644

26 libsystem_pthread.dylib 0x1825def1c _pthread_wqthread + 932

27 libsystem_pthread.dylib 0x1825deb6c start_wqthread + 4

I'm also still seeing this on "11.2.x" including the latest 11.2.5. Hundreds per day on a popular image-heavy app. Exclusivly when low on RAM.

Same here. We build a news feed application which contains many images. This crash randomlly(our DAU 10 Million, crash 2K per day, 2%%) only on iOS 11.2.0- 11.2.5 user both on iPhone/iPod Touch/iPad...Any walkaround or solution for this ?



We use Fabric to collect the crash log, here is one sample :


# Organization: News
# Platform: ios
# Application: 
# Version: 6.6.0.04
# Bundle Identifier: com.ss.iphone.article.News
# Issue #: 331124
# Issue ID: 59f875c861b02d480d84c4c8
# Session ID: b9bfdd3d52ac4a839e1ba22fc5bece4d_DNE_0_v2
# Date: 2018-02-22T12:49:00Z
# OS Version: 11.2.5 (15D60)
# Device: iPhone 7 Plus
# RAM Free: 1.7%
# Disk Free: 22%


#0. Crashed: com.apple.main-thread
0  CoreGraphics                   0x18404259c ERROR_CGDataProvider_BufferIsNotReadable + 12
1  CoreGraphics                   0x1840422c0 CGDataProviderRetainBytePtr + 216
2  QuartzCore                     0x186715f84 CA::Render::(anonymous namespace)::create_image_from_image_data(CGImage*, CGColorSpace*, unsigned int, unsigned int, double) + 196
3  QuartzCore                     0x1867140dc CA::Render::create_image(CGImage*, CGColorSpace*, unsigned int, double) + 900
4  QuartzCore                     0x186716d9c CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double, double) + 472
5  QuartzCore                     0x186717164 CA::Render::prepare_image(CGImage*, CGColorSpace*, unsigned int, double) + 20
6  QuartzCore                     0x186826158 CA::Layer::prepare_commit(CA::Transaction*) + 332
7  QuartzCore                     0x18678840c CA::Context::commit_transaction(CA::Transaction*) + 576
8  QuartzCore                     0x1867afb40 CA::Transaction::commit() + 540
9  QuartzCore                     0x1867b0980 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
10 CoreFoundation                 0x18277acdc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
11 CoreFoundation                 0x182778694 __CFRunLoopDoObservers + 412
12 CoreFoundation                 0x182778c50 __CFRunLoopRun + 1292
13 CoreFoundation                 0x182698c58 CFRunLoopRunSpecific + 436
14 GraphicsServices               0x184544f84 GSEventRunModal + 100
15 UIKit                          0x18bdf15c4 UIApplicationMain + 236
16 News                           0x1006c71e0 main (main.m:19)
17 libdyld.dylib                  0x1821b856c start + 4


--


#0. Crashed: com.apple.main-thread
0  CoreGraphics                   0x18404259c ERROR_CGDataProvider_BufferIsNotReadable + 12
1  CoreGraphics                   0x1840422c0 CGDataProviderRetainBytePtr + 216
2  QuartzCore                     0x186715f84 CA::Render::(anonymous namespace)::create_image_from_image_data(CGImage*, CGColorSpace*, unsigned int, unsigned int, double) + 196
3  QuartzCore                     0x1867140dc CA::Render::create_image(CGImage*, CGColorSpace*, unsigned int, double) + 900
4  QuartzCore                     0x186716d9c CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double, double) + 472
5  QuartzCore                     0x186717164 CA::Render::prepare_image(CGImage*, CGColorSpace*, unsigned int, double) + 20
6  QuartzCore                     0x186826158 CA::Layer::prepare_commit(CA::Transaction*) + 332
7  QuartzCore                     0x18678840c CA::Context::commit_transaction(CA::Transaction*) + 576
8  QuartzCore                     0x1867afb40 CA::Transaction::commit() + 540
9  QuartzCore                     0x1867b0980 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
10 CoreFoundation                 0x18277acdc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
11 CoreFoundation                 0x182778694 __CFRunLoopDoObservers + 412
12 CoreFoundation                 0x182778c50 __CFRunLoopRun + 1292
13 CoreFoundation                 0x182698c58 CFRunLoopRunSpecific + 436
14 GraphicsServices               0x184544f84 GSEventRunModal + 100
15 UIKit                          0x18bdf15c4 UIApplicationMain + 236
16 News                           0x1006c71e0 main (main.m:19)
17 libdyld.dylib                  0x1821b856c start + 4


#1. Thread
0  libsystem_kernel.dylib         0x1822e80f0 __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1823fece4 _pthread_cond_wait$VARIANT$mp + 640
2  libc++.1.dylib                 0x18199ff34 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) + 96
3  JavaScriptCore                 0x189b41168 std::__1::cv_status std::__1::condition_variable::wait_until<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const&) + 124
4  JavaScriptCore                 0x189b4103c std::__1::cv_status std::__1::condition_variable_any::wait_until<std::__1::unique_lock<bmalloc::Mutex>, std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >(std::__1::unique_lock<bmalloc::Mutex>&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const&) + 108
5  JavaScriptCore                 0x189b40ec0 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadRunLoop() + 280
6  JavaScriptCore                 0x189b411b8 void* 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::*)()>*> >(void*) + 44
7  libsystem_pthread.dylib        0x1823fc2b4 _pthread_body + 308
8  libsystem_pthread.dylib        0x1823fc180 _pthread_body + 310
9  libsystem_pthread.dylib        0x1823fab74 thread_start + 4


#2. WebThread
0  libsystem_kernel.dylib         0x1822c7568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1822c73e0 mach_msg + 72
2  CoreFoundation                 0x18277b108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x182778cd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x182698c58 CFRunLoopRunSpecific + 436
5  WebCore                        0x18a60d84c RunWebThread(void*) + 560
6  libsystem_pthread.dylib        0x1823fc2b4 _pthread_body + 308
7  libsystem_pthread.dylib        0x1823fc180 _pthread_body + 310
8  libsystem_pthread.dylib        0x1823fab74 thread_start + 4


#3. com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x1822c7568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1822c73e0 mach_msg + 72
2  CoreFoundation                 0x18277b108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x182778cd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x182698c58 CFRunLoopRunSpecific + 436
5  Foundation                     0x1830cd594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6  Foundation                     0x1830ec9ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7  UIKit                          0x18c95b7a8 -[UIEventFetcher threadMain] + 136
8  Foundation                     0x1831cf0f4 __NSThread__start__ + 996
9  libsystem_pthread.dylib        0x1823fc2b4 _pthread_body + 308
10 libsystem_pthread.dylib        0x1823fc180 _pthread_body + 310
11 libsystem_pthread.dylib        0x1823fab74 thread_start + 4


#4. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x1822c7568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1822c73e0 mach_msg + 72
2  CoreFoundation                 0x18277b108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x182778cd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x182698c58 CFRunLoopRunSpecific + 436
5  CFNetwork                      0x182f87b08 -[__CoreSchedulingSetRunnable runForever] + 780
6  Foundation                     0x1831cf0f4 __NSThread__start__ + 996
7  libsystem_pthread.dylib        0x1823fc2b4 _pthread_body + 308
8  libsystem_pthread.dylib        0x1823fc180 _pthread_body + 310
9  libsystem_pthread.dylib        0x1823fab74 thread_start + 4


#5. com.twitter.crashlytics.ios.MachExceptionServer
0  News                           0x1033d57f0 CLSProcessRecordAllThreads + 3051420
1  News                           0x1033d57f0 CLSProcessRecordAllThreads + 3051420
2  News                           0x1033d56ac CLSProcessRecordAllThreads + 3051096
3  News                           0x1033c5e6c CLSHandler + 2987544
4  News                           0x1033c0e10 CLSMachExceptionServer + 2966972
5  libsystem_pthread.dylib        0x1823fc2b4 _pthread_body + 308
6  libsystem_pthread.dylib        0x1823fc180 _pthread_body + 310
7  libsystem_pthread.dylib        0x1823fab74 thread_start + 4

I get this when I attempt to CGContextDrawImage a CGImage that's backing a UIImage.


I've hit this in the debugger a few times now.

When I attempt to display the UIImage in the debugger, I see the following additional lines then added to the console:


2018-02-23 18:19:00.963013-0500 Photobooth[1455:1000835] handle_error:351: zlib error

2018-02-23 18:19:00.963113-0500 Photobooth[1455:1000835] handle_error:351: No IDATs written into file

(lldb)

I have a same issue :3

Same here on iOS 10.3.3-11.2.5. I haven't been able to reproduce it yet. Any clues ?


#0 Thread
SIGSEGV
SEGV_ACCER
0 ImageIO
PNGReadPlugin::copyImageBlockSet(InfoRec*, CGImageProvider*, CGRect, CGSize, __CFDictionary const*)+ 3368
1 ImageIO
PNGReadPlugin::copyImageBlockSet(InfoRec*, CGImageProvider*, CGRect, CGSize, __CFDictionary const*)+ 3336
2 ImageIO
PNGReadPlugin::CopyImageBlockSetProc(void*, CGImageProvider*, CGRect, CGSize, __CFDictionary const*) + 192
3 ImageIO
IIOImageProviderInfo::copyImageBlockSetWithOptions(CGImageProvider*, CGRect, CGSize, __CFDictionary const*) + 632
4 ImageIO
IIOImageProviderInfo::CopyImageBlockSetWithOptions(void*, CGImageProvider*, CGRect, CGSize, __CFDictionary const*) + 340
5 QuartzCore
CA::Render::(anonymous namespace)::create_image_from_image_provider(CGImage*, CGImageProvider*, CGColorSpace*, unsigned int) + 588
6 QuartzCore
CA::Render::create_image(CGImage*, CGColorSpace*, unsigned int, double) + 760
7 QuartzCore
CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double, double) + 472
8 QuartzCore
CA::Render::prepare_image(CGImage*, CGColorSpace*, unsigned int, double) + 16
9 QuartzCore
CA::Layer::prepare_commit(CA::Transaction*) + 292
10 QuartzCore
CA::Context::commit_transaction(CA::Transaction*) + 264
11 QuartzCore
CA::Transaction::commit() + 504
12 QuartzCore
CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 600
13 IOKit
IODispatchCalloutFromCFMessage + 372
14 CoreFoundation
___CFMachPortPerform + 180
15 CoreFoundation
___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
16 CoreFoundation
___CFRunLoopDoSource1 + 436
17 CoreFoundation
___CFRunLoopRun + 1752
18 CoreFoundation
CFRunLoopRunSpecific + 424
19 GraphicsServices
GSEventRunModal + 100
20 UIKit
UIApplicationMain + 208
21 AppName
main (main.m:17)
22 libdyld.dylib
_start + 4

I got the same question. When I try to save a image to filePath.

iOS 11.2.6, iPhone 8Plus

Here is my code :

UIImage* quickFilteredImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();


/

CGImageRelease(imageLeft);

CGImageRelease(imageRight);

/


CGImageRelease([warpLeft CGImage]);

CGImageRelease([warpRight CGImage]);


if (savePath != nil && quickFilteredImage) {

[UIImageJPEGRepresentation(quickFilteredImage, 0.9) writeToFile:savePath

options:NSDataWritingAtomic

error:NULL];

return nil;

}

return quickFilteredImage;

// ============================================================================================================



I got this crash.


#62 Thread

SIGSEGV

SEGV_ACCERR

0 CoreGraphics

_ERROR_CGDataProvider_BufferIsNotReadable + 12

1 CoreGraphics

CGDataProviderRetainBytePtr + 216

2 CoreGraphics

CGDataProviderCopyData + 56

3 ImageIO

IIOImagePixelDataProvider::getBytesDataProvider(void*, unsigned long) + 408

4 ImageIO

AppleJPEGWritePlugin::writeOne(IIOImagePixelDataProvider*, IIODictionary*, IIODictionary*, unsigned int) + 1200

5 ImageIO

IIO_Writer_AppleJPEG::write(void*, void*) + 56

6 ImageIO

IIOImageDestination::finalize() + 1600

7 UIKit

_UIImageJPEGRepresentation + 652

8 creator

-[DLStitchingWarper StitchingImage:savePath:isTwoImgStyle:] + 1288

9 creator

__56-[ZHCHttpManager sdImageWith:saveIn:completion:failure:]_block_invoke_2 + 116

10 libdispatch.dylib

__dispatch_call_block_and_release + 24

11 libdispatch.dylib

__dispatch_client_callout + 16

12 libdispatch.dylib

__dispatch_queue_override_invoke$VARIANT$armv81 + 700

13 libdispatch.dylib

__dispatch_root_queue_drain + 568

14 libdispatch.dylib

__dispatch_worker_thread3 + 112

15 libsystem_pthread.dylib

_pthread_wqthread + 1268

I have same issue in iOS 11.2. When I hanle large images.


#4779 SIGSEGV
SEGV_ACCERR
0 CoreGraphics_ERROR_CGDataProvider_BufferIsNotReadable + 12


1CoreGraphicsCGDataProviderRetainBytePtr + 216

2CoreGraphicsCGDataProviderCopyData + 56

3ImageIOIIOImagePixelDataProvider::getBytesDataProvider(void*, unsigned long) + 408

4ImageIOAppleJPEGWritePlugin::writeOne(IIOImagePixelDataProvider*, IIODictionary*, IIODictionary*, unsigned int) + 1200

5ImageIOIIO_Writer_AppleJPEG::write(void*, void*) + 56

6ImageIOIIOImageDestination::finalize() + 1600

7UIKit_UIImageJPEGRepresentation + 652

8creator-[DLStitchingWarper StitchingImage:savePath:isTwoImgStyle:] + 1288

9creator__56-[ZHCHttpManager sdImageWith:saveIn:completion:failure:]_block_invoke_2 + 116

10libdispatch.dylib__dispatch_call_block_and_release + 24

11libdispatch.dylib__dispatch_client_callout + 16

12libdispatch.dylib__dispatch_queue_override_invoke$VARIANT$armv81 + 700

13libdispatch.dylib__dispatch_root_queue_drain + 568

14libdispatch.dylib__dispatch_worker_thread3 + 112

15libsystem_pthread.dylib_pthread_wqthread + 1268


Here is my code :



    CGSize resultSize = CGSizeMake(7000, 3500);
    UIGraphicsBeginImageContext(resultSize);
    [warpLeft drawInRect:CGRectMake(0,0, resultSize.width/2, resultSize.height)];
    [warpRight drawInRect:CGRectMake(resultSize.width/2,0, resultSize.width/2, resultSize.height)];
   
    UIImage *quickFilteredImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
   
    CGImageRelease([warpLeft CGImage]);
    CGImageRelease([warpRight CGImage]);

    if (savePath != nil) { // write Tiff in image
        @autoreleasepool {[self zhc_setObjectwithTiff:UIImageJPEGRepresentation(quickFilteredImage, 0.9) forKey:savePath withImageI:imageData];}
        return nil;
    }else {
        return quickFilteredImage;
    }

Same crash. Posted the question on SO.

How can I contact you? mail ?

How can I contact you? mail ?

How can I contact you ? mail. The same as me, I can reproduce it.

Any Progress?

Someone posted this SO. https://stackoverflow.com/questions/49429715/core-graphics-quartz-2d-image-resizing-crashes

but no answer yet. I think this is a memory issue, the data deallocated, since there are no strong refrence to it. The lifetime of image data only valid within the function, so OS will deallocate it if it needs.

this error also happend in 11.3 iphone8.



Thread 7 Crashed:

0 CoreGraphics 0x0000000184b78828 ERROR_CGDataProvider_BufferIsNotReadable + 16

1 CoreGraphics 0x0000000184b78548 CGDataProviderRetainBytePtr + 216

2 CoreGraphics 0x0000000184d72cc8 CGAccessSessionCreate + 68

3 CoreGraphics 0x0000000184c699a0 img_data_lock + 1268

4 CoreGraphics 0x0000000184c69454 CGSImageDataLock + 184

5 CoreGraphics 0x0000000184a87450 ripc_AcquireRIPImageData + 308

6 CoreGraphics 0x0000000184c7df6c ripc_DrawImage + 652

7 CoreGraphics 0x0000000184c6ddf8 CGContextDrawImageWithOptions + 660

8 LIKE 0x00000001033a7854 YYCGImageCreateDecodedCopy (YYImageCoder.m:889)

9 LIKE 0x00000001033aec8c -[UIImage(YYImageCoder) imageByDecoded] (YYImageCoder.m:2769)

10 LIKE 0x00000001033b3d9c __51-[YYImageCache setImage:imageData:forKey:withType:]_block_invoke (YYImageCache.m:134)

11 libdispatch.dylib 0x0000000182ac4b24 _dispatch_call_block_and_release + 24

12 libdispatch.dylib 0x0000000182ac4ae4 _dispatch_client_callout + 16

13 libdispatch.dylib 0x0000000182acea38 _dispatch_queue_serial_drain$VARIANT$mp + 608

14 libdispatch.dylib 0x0000000182acf380 _dispatch_queue_invoke$VARIANT$mp + 336

15 libdispatch.dylib 0x0000000182acfd4c _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 340

16 libdispatch.dylib 0x0000000182ad811c _dispatch_workloop_worker_thread$VARIANT$mp + 668

17 libsystem_pthread.dylib 0x0000000182df7e70 _pthread_wqthread + 860

ERROR_CGDataProvider_BufferIsNotReadable crash
 
 
Q