iOS crash with newer devices when loading large images
🐛 Bug Report
My app crashed for some of my ios users (5-10%, mostly iPhone 13-15) when displaying a screen with CachedNetworkImage and the image was too big (like 2000x3000px). This was the crashlytics stacktrace:
Crashed: io.flutter.1.ui
0 libsystem_kernel.dylib 0xa974 __pthread_kill + 8
1 libsystem_pthread.dylib 0x60ec pthread_kill + 268
2 libsystem_c.dylib 0x75b80 abort + 180
3 Flutter 0x5cb72c InternalFlutterGpu_Texture_AsImage + 50508
4 Flutter 0x6b1578 InternalFlutterGpu_Texture_AsImage + 992152
5 Flutter 0x618a30 InternalFlutterGpu_Texture_AsImage + 366672
6 Flutter 0x677494 InternalFlutterGpu_Texture_AsImage + 754356
7 Flutter 0x5e09f4 InternalFlutterGpu_Texture_AsImage + 137236
8 Flutter 0x62aa50 InternalFlutterGpu_Texture_AsImage + 440432
9 App 0xbe6c stub CallBootstrapNative + 32364
10 App 0x31950 SendPort._sendInternal + 250 (isolate_patch.dart:250)
11 App 0x2b654 IOService._dispatch + 231 (isolate_patch.dart:231)
12 App 0x6ef328 RawSecureSocket._pushAllFilterStages + 1145 (secure_socket.dart:1145)
13 App 0x6ee9b0 RawSecureSocket._tryFilter + 1006 (secure_socket.dart:1006)
14 App 0x6ee90c RawSecureSocket._scheduleFilter + 989 (secure_socket.dart:989)
15 App 0x6f09c0 RawSecureSocket._readHandler + 863 (secure_socket.dart:863)
16 App 0x6f08c8 RawSecureSocket._eventDispatcher + 854 (secure_socket.dart:854)
17 App 0x6f0e68 RawSecureSocket._eventDispatcher (#2) + 849 (secure_socket.dart:849)
18 App 0x787ad8 RootZone.runUnaryGuarded + 1594 (zone.dart:1594)
19 App 0x742c6c BufferingStreamSubscription._sendData + 341 (stream_impl.dart:341)
20 App 0x6d6b20 BufferingStreamSubscription._add + 273 (stream_impl.dart:273)
21 App 0x6d69d0 StreamController._add + 660 (stream_controller.dart:660)
22 App 0x66a50 StreamController.add (#3) + 605 (stream_controller.dart:605)
23 App 0x6ec270 new _RawSocket.<anonymous closure> (#4) + 1936 (socket_patch.dart:1936)
24 App 0x6e9d78 NativeSocket.issueReadEvent.issue + 1380 (socket_patch.dart:1380)
25 App 0x1be6c microtaskLoop + 34 (schedule_microtask.dart:34)
26 App 0x1bd6c startMicrotaskLoop (#2) + 54 (schedule_microtask.dart:54)
27 App 0x1bd30 startMicrotaskLoop + 44 (schedule_microtask.dart:44)
28 App 0xbb74 stub InvokeDartCode + 31604
29 Flutter 0x60712c InternalFlutterGpu_Texture_AsImage + 294732
30 Flutter 0x720c34 InternalFlutterGpu_Texture_AsImage + 1448532
31 Flutter 0x41c050 (Fehlt UUID 4c4c447355553144a149a4a73b6eae0b)
32 Flutter 0x2e91a4 (Fehlt UUID 4c4c447355553144a149a4a73b6eae0b)
33 Flutter 0x2ec6bc (Fehlt UUID 4c4c447355553144a149a4a73b6eae0b)
34 CoreFoundation 0xad6e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
35 CoreFoundation 0xad388 __CFRunLoopDoTimer + 1004
36 CoreFoundation 0x37184 __CFRunLoopDoTimers + 288
37 CoreFoundation 0x3418c __CFRunLoopRun + 1856
38 CoreFoundation 0x33968 CFRunLoopRunSpecific + 608
39 Flutter 0x2ec7a8 (Fehlt UUID 4c4c447355553144a149a4a73b6eae0b)
40 Flutter 0x2ebe20 (Fehlt UUID 4c4c447355553144a149a4a73b6eae0b)
41 libsystem_pthread.dylib 0x2a90 _pthread_start + 136
42 libsystem_pthread.dylib 0x1fcc thread_start + 8
The solution to this problem is to add reasonable values to maxHeightDiskCache or maxWidthDiskCache, but it took me some time to find that out.
Expected behavior
App should not crash, even when not specifying maxHeightDiskCache and maxWidthDiskCache
Reproduction steps
Display an large image using CachedNetworkImage
Configuration
Version: 3.3.1
Platform:
- :iphone: iOS (mostly iPhone 13-15)
Hello @TimBaumgart can you let me know what value have you added in the maxHeightDiskCache and maxWidthDiskCache, I am facing similar issue.
Thank you
Hi @vraj129 maxHeightDiskCache and maxWidthDiskCache seems to not have any effect on the issue. The actual "solution" for me was to disable impeller for iOS. See this issue for reference: https://github.com/flutter/flutter/issues/150183