LineChartRenderer.drawValues crash
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
## 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 __NSThread__start__ + 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 __NSThread__start__ + 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 __NSThread__start__ + 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 __NSThread__start__ + 716
12 libsystem_pthread.dylib 0x16b8 _pthread_start + 148
13 libsystem_pthread.dylib 0xb88 thread_start + 8
Contributor guide
Research direction
Start by inspecting LineChartRenderer.drawValues(context:) and the call from BarLineChartViewBase.swift:291, using the supplied Crashlytics stack trace as the entry point. The report provides no reproduction steps or demo project, so first determine the conditions that trigger the crash in the SwiftUI iOS application. Done means the crash cause is identified and a reliable fix or reproduction is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100