ChartsOrg / Charts

Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Apache License 2.0
27.48k stars 5.98k forks source link

LineChartRenderer.drawValues crash #5090

Open katerina-mogozina-923 opened 1 year ago

katerina-mogozina-923 commented 1 year ago

What did you do?

I'm using BarChartView in the SwiftUI application.

What did you expect to happen?

I expected it to work stable.

What happened instead?

I received a crash on the Firebase from one of our users. I could not reproduce it, so I do not know the steps.

DGCharts Environment

DGCharts version/Branch/Commit Number: Xcode version: 14.3.1 Swift version: Swift 5 Platform(s) running DGCharts: iOS macOS version running Xcode: 13.4 Charts version: v4.1.0

Demo Project

I wasn't able to reproduce the crash myself, just received crash reports from Firebase Crashlytics.

Crashlytics - Stack trace Application: NDA Platform: apple Version: 1.2.0 (133) Issue: 32525647726e0812dfac19379c81f460 Session: f4218d6e5a72455a9bdfd3609079f2d9_DNE_0_v2 Date: Sat Aug 05 2023 22:42:23 GMT+0300 (Eastern European Summer Time)

Crashed: com.apple.main-thread 0 NDA 0x6ea8b4 LineChartRenderer.drawValues(context:) + 4341868724 (:4341868724) 1 NDA 0x6ea918 @objc LineChartRenderer.drawValues(context:) + 4341868824 (:4341868824) 2 NDA 0x669900 BarLineChartViewBase.draw(:) + 291 (BarLineChartViewBase.swift:291) 3 NDA 0x6699e4 @objc BarLineChartViewBase.draw(:) + 4341340644 (:4341340644) 4 UIKitCore 0x1aa848 -[UIView(CALayerDelegate) drawLayer:inContext:] + 508 5 QuartzCore 0x1e810 CABackingStoreUpdate + 204 6 QuartzCore 0x95d00 invocation function for block in CA::Layer::display() + 64 7 QuartzCore 0x1de98 -[CALayer _display] + 1720 8 QuartzCore 0x1d6f8 CA::Layer::layout_and_display_if_needed(CA::Transaction) + 412 9 QuartzCore 0x2ea1c CA::Context::commit_transaction(CA::Transaction, double, double*) + 444 10 QuartzCore 0x5dff4 CA::Transaction::commit() + 648 11 QuartzCore 0x47f3c CA::Transaction::flush_as_runloop_observer(bool) + 88 12 UIKitCore 0x4fdc04 _UIApplicationFlushCATransaction + 52 13 UIKitCore 0x64e4b0 _UIUpdateSequenceRun + 84 14 UIKitCore 0xcb2c8c schedulerStepScheduledMainSection + 144 15 UIKitCore 0xcb21e8 runloopSourceCallback + 92 16 CoreFoundation 0xd3128 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 17 CoreFoundation 0xdf7b4 CFRunLoopDoSource0 + 176 18 CoreFoundation 0x645e8 CFRunLoopDoSources0 + 244 19 CoreFoundation 0x7a0d4 __CFRunLoopRun + 828 20 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 21 GraphicsServices 0x135c GSEventRunModal + 164 22 UIKitCore 0x39d6e8 -[UIApplication _run] + 888 23 UIKitCore 0x39d34c UIApplicationMain + 340 24 SwiftUI 0x1bc41c OUTLINED_FUNCTION_895 + 2472 25 SwiftUI 0x1229bc block_copy_helper.1 + 496 26 SwiftUI 0x10ca64 OUTLINED_FUNCTION_901 + 2752 27 NDA 0xabbc main + 16 (NDAApp.swift:16) 28 ??? 0x1dcd1adec (Missing)

Thread 0 libsystem_kernel.dylib 0x118c __workq_kernreturn + 8 1 libsystem_pthread.dylib 0xe28 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xb7c start_wqthread + 8

Thread 0 libsystem_kernel.dylib 0x118c __workq_kernreturn + 8 1 libsystem_pthread.dylib 0xe28 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xb7c start_wqthread + 8

com.google.firebase.crashlytics.MachExceptionServer 0 libsystem_kernel.dylib 0xc84 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x13b54 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x13e2c mach_msg_overwrite + 540 3 libsystem_kernel.dylib 0x11c8 mach_msg + 24 4 NDA 0x409fa8 FIRCLSMachExceptionServer + 192 (FIRCLSMachException.c:192) 5 libsystem_pthread.dylib 0x16b8 _pthread_start + 148 6 libsystem_pthread.dylib 0xb88 thread_start + 8

Thread 0 libsystem_kernel.dylib 0x1144 __semwait_signal + 8 1 libsystem_c.dylib 0x5888 nanosleep + 220 2 libsystem_c.dylib 0x16b1c sleep + 52 3 NDA 0x8c43e8 monitorCachedData + 144 (SentryCrashCachedData.c:144) 4 libsystem_pthread.dylib 0x16b8 _pthread_start + 148 5 libsystem_pthread.dylib 0xb88 thread_start + 8

SentryCrash Exception Handler (Secondary) 0 libsystem_kernel.dylib 0xc84 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x13b54 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x13e2c mach_msg_overwrite + 540 3 libsystem_kernel.dylib 0x11c8 mach_msg + 24 4 NDA 0x8bfee8 handleExceptions + 305 (SentryCrashMonitor_MachException.c:305) 5 libsystem_pthread.dylib 0x16b8 _pthread_start + 148 6 libsystem_pthread.dylib 0xb88 thread_start + 8

io.sentry.app-hang-tracker 0 libsystem_kernel.dylib 0x1144 semwait_signal + 8 1 libsystem_c.dylib 0x5888 nanosleep + 220 2 Foundation 0xb27cc +[NSThread sleepForTimeInterval:] + 160 3 NDA 0x866708 -[SentryANRTracker detectANRs] + 75 (SentryANRTracker.m:75) 4 Foundation 0x5b544 NSThreadstart + 716 5 libsystem_pthread.dylib 0x16b8 _pthread_start + 148 6 libsystem_pthread.dylib 0xb88 thread_start + 8

com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0xc84 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x13b54 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x13e2c mach_msg_overwrite + 540 3 libsystem_kernel.dylib 0x11c8 mach_msg + 24 4 CoreFoundation 0x79024 CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x7a250 CFRunLoopRun + 1208 6 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 7 Foundation 0x41fd4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 8 Foundation 0x41ebc -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 9 UIKitCore 0x4d03fc -[UIEventFetcher threadMain] + 416 10 Foundation 0x5b544 NSThreadstart__ + 716 11 libsystem_pthread.dylib 0x16b8 _pthread_start + 148 12 libsystem_pthread.dylib 0xb88 thread_start + 8

com.apple.NSURLConnectionLoader 0 libsystem_kernel.dylib 0xc84 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x13b54 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x13e2c mach_msg_overwrite + 540 3 libsystem_kernel.dylib 0x11c8 mach_msg + 24 4 CoreFoundation 0x79024 CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x7a250 CFRunLoopRun + 1208 6 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 7 CFNetwork 0x259580 _CFURLStorageSessionDisableCache + 60900 8 Foundation 0x5b544 NSThreadstart__ + 716 9 libsystem_pthread.dylib 0x16b8 _pthread_start + 148 10 libsystem_pthread.dylib 0xb88 thread_start + 8

Thread 0 libsystem_kernel.dylib 0x118c __workq_kernreturn + 8 1 libsystem_pthread.dylib 0xe28 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xb7c start_wqthread + 8

Thread 0 libsystem_kernel.dylib 0x118c __workq_kernreturn + 8 1 libsystem_pthread.dylib 0xe28 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xb7c start_wqthread + 8

Thread 0 libsystem_kernel.dylib 0x118c __workq_kernreturn + 8 1 libsystem_pthread.dylib 0xe28 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xb7c start_wqthread + 8

Thread 0 libsystem_pthread.dylib 0xb74 start_wqthread + 254

com.apple.SwiftUI.AsyncRenderer 0 libsystem_kernel.dylib 0xc84 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x13b54 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x13e2c mach_msg_overwrite + 540 3 libsystem_kernel.dylib 0x11c8 mach_msg + 24 4 CoreFoundation 0x79024 CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x7a250 CFRunLoopRun + 1208 6 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 7 Foundation 0x41fd4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 8 Foundation 0x41e68 -[NSRunLoop(NSRunLoop) run] + 64 9 SwiftUI 0xa0d74 OUTLINED_FUNCTION_581 + 852 10 SwiftUI 0x9eecc swift_memcpy40_8 + 2100 11 Foundation 0x5b544 NSThreadstart + 716 12 libsystem_pthread.dylib 0x16b8 _pthread_start + 148 13 libsystem_pthread.dylib 0xb88 thread_start + 8

JeffersonSchuler commented 1 year ago

We have similar crashes in our apps also using SwiftUI. We have been unable to reproduce on any kind of consistent basis. We are just using a line chart with multiple lines and a custom balloon marker.

Crashed: com.apple.main-thread 0 Reflex 0x4e981c LineChartRenderer.drawHighlighted(context:indices:) + 800 (LineChartRenderer.swift:800) 1 Reflex 0x4e98f0 @objc LineChartRenderer.drawHighlighted(context:indices:) + 4304853232 (:4304853232) 2 Reflex 0x4671f0 BarLineChartViewBase.draw(:) + 251 (BarLineChartViewBase.swift:251) 3 Reflex 0x4675f4 @objc BarLineChartViewBase.draw(:) + 4304319988 (:4304319988) 4 UIKitCore 0x1aa0b8 -[UIView(CALayerDelegate) drawLayer:inContext:] + 508 5 QuartzCore 0x1e6cc CABackingStoreUpdate + 204 6 QuartzCore 0x95c34 invocation function for block in CA::Layer::display() + 64 7 QuartzCore 0x1dd54 -[CALayer _display] + 1720 8 QuartzCore 0x1d5b4 CA::Layer::layout_and_display_if_needed(CA::Transaction) + 412 9 QuartzCore 0x2e8d8 CA::Context::commit_transaction(CA::Transaction, double, double*) + 444 10 QuartzCore 0x5de80 CA::Transaction::commit() + 648 11 QuartzCore 0x47df0 CA::Transaction::flush_as_runloop_observer(bool) + 88 12 UIKitCore 0x4fd4d0 _UIApplicationFlushCATransaction + 52 13 UIKitCore 0x64dd94 _UIUpdateSequenceRun + 84 14 UIKitCore 0xcb2894 schedulerStepScheduledMainSection + 144 15 UIKitCore 0xcb1df0 runloopSourceCallback + 92 16 CoreFoundation 0xd3128 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 17 CoreFoundation 0xdf7b4 CFRunLoopDoSource0 + 176 18 CoreFoundation 0x645e8 CFRunLoopDoSources0 + 244 19 CoreFoundation 0x7a0d4 __CFRunLoopRun + 828 20 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 21 GraphicsServices 0x135c GSEventRunModal + 164 22 UIKitCore 0x39cf58 -[UIApplication _run] + 888 23 UIKitCore 0x39cbbc UIApplicationMain + 340 24 Reflex 0x46b4 main + 15 (AppDelegate.swift:15) 25 ??? 0x1b1174dec (Missing)

maetzemax commented 9 months ago

We encounter the same kind of error here. It appears frequently in our Crashlytics. Are there any updates?

nirajnj commented 6 months ago

We are facing the same error in our Firebase Crashlytics reports. Are there any updates?

LineChartRenderer.drawValues(context:)

Screenshot 2024-01-31 at 10 45 08 PM

issue_59376f3875764a20a119bf921fa62fbb_crash_session_dcc7693461f84b67b455e9472b56fe84_DNE_0_v2_stacktrace.txt

leCandas commented 4 months ago

I am getting the same issue in production are there any solution? Screenshot 2024-04-15 at 09 33 54