Charts icon indicating copy to clipboard operation
Charts copied to clipboard

LineChartRenderer drawHighlighted(context: CGContext, indices: [Highlight]) crash

Open AlexandrKovtunenkoDevX opened this issue 2 years ago • 5 comments

What did you do?

[presumably] Using Lihe chart view with live updates user taps chart view

What did you expect to happen?

"Highlighted" line to y axis is displayed on chart view

What happened instead?

App crashes on guard let set = lineData[high.dataSetIndex] as? LineChartDataSetProtocol with "index out of range" exception

Charts Environment

Charts (4.1.0) Xcode v.14.0.1 Swift 5 Platform: iOS macOS v.12.5.1

Demo Project

Wasn't able to reproduce the crash myself, just received crash reports from Firebase Crashlytics and through XCode reports. Reproduce rate: [presumably] low, 6 events during first week after release Crash Log example: `Date/Time: 2022-10-16 20:48:11.7358 -0500 Launch Time: 2022-10-16 20:43:46.4317 -0500 OS Version: iPhone OS 15.6.1 (19G82) Release Type: User Baseband Version: 1.70.01 Report Version: 104

Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000010151ecb4 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [72164]

Triggered by Thread: 0

Kernel Triage: VM - pmap_enter failed with resource shortage

Thread 0 name: Thread 0 Crashed: 0 Charts 0x000000010151ecb4 Swift runtime failure: Index out of range + 0 (:0) 1 Charts 0x000000010151ecb4 specialized ArrayBuffer.checkInoutAndNativeTypeCheckedBounds(:wasNativeTypeChecked:) + 4 (:0) 2 Charts 0x000000010151ecb4 specialized Array.checkSubscript(:wasNativeTypeChecked:) + 4 (:0) 3 Charts 0x000000010151ecb4 specialized Array.subscript.getter + 4 (ChartData.swift:452) 4 Charts 0x000000010151ecb4 ChartData.subscript.getter + 4 (:0) 5 Charts 0x000000010151ecb4 LineChartRenderer.drawHighlighted(context:indices:) + 1312 6 Charts 0x000000010151e8f8 ChartData.subscript.getter + 4 (ChartData.swift:452) 7 Charts 0x000000010151e8f8 LineChartRenderer.drawHighlighted(context:indices:) + 356 (LineChartRenderer.swift:763) 8 Charts 0x000000010151ed94 @objc LineChartRenderer.drawHighlighted(context:indices:) + 108 (:0) 9 Charts 0x00000001014c1908 BarLineChartViewBase.draw(:) + 2116 (BarLineChartViewBase.swift:251) 10 Charts 0x00000001014c1d0c @objc BarLineChartViewBase.draw(:) + 68 (:0) 11 UIKitCore 0x000000018a4290b4 -[UIView(CALayerDelegate) drawLayer:inContext:] + 608 (UIView.m:18154) 12 QuartzCore 0x000000018bbb4564 CABackingStoreUpdate + 192 (CABackingStore.cpp:1319) 13 QuartzCore 0x000000018bbf809c ___ZN2CA5Layer8display_Ev_block_invoke + 64 (CALayer.mm:9538) 14 QuartzCore 0x000000018bbf9b9c -[CALayer _display] + 1912 (CALayer.mm:9536) 15 QuartzCore 0x000000018bb98d7c CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 420 (CALayer.mm:2447) 16 QuartzCore 0x000000018bbad5b4 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 452 (CAContextInternal.mm:2612) 17 QuartzCore 0x000000018bbb64a8 CA::Transaction::commit() + 704 (CATransactionInternal.mm:449) 18 QuartzCore 0x000000018bb983a0 CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:956) 19 UIKitCore 0x000000018a7e06e0 _UIApplicationFlushCATransaction + 72 (UIApplication.m:0) 20 UIKitCore 0x000000018aa7ad5c _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:112) 21 UIKitCore 0x000000018b101edc schedulerStepScheduledMainSection + 144 (_UIUpdateScheduler.m:778) 22 UIKitCore 0x000000018b1016a4 runloopSourceCallback + 92 (_UIUpdateScheduler.m:870) 23 CoreFoundation 0x0000000187edf414 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 (CFRunLoop.c:1972) 24 CoreFoundation 0x0000000187ef01a0 __CFRunLoopDoSource0 + 208 (CFRunLoop.c:2016) 25 CoreFoundation 0x0000000187e29694 __CFRunLoopDoSources0 + 268 (CFRunLoop.c:2053) 26 CoreFoundation 0x0000000187e2f05c __CFRunLoopRun + 828 (CFRunLoop.c:2951) 27 CoreFoundation 0x0000000187e42bc8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268) 28 GraphicsServices 0x00000001a3fae374 GSEventRunModal + 164 (GSEvent.c:2200) 29 UIKitCore 0x000000018a7b6b58 -[UIApplication _run] + 1100 (UIApplication.m:3511) 30 UIKitCore 0x000000018a538090 UIApplicationMain + 364 (UIApplication.m:5064) 31 Lightspeed 0x000000010031ca70 main + 176 (main.swift:11) 32 dyld 0x000000010077dda4 start + 520 (dyldMain.cpp:879)`

AlexandrKovtunenkoDevX avatar Nov 03 '22 12:11 AlexandrKovtunenkoDevX

Hi! I have the same problem.

Charts (4.1.0) Xcode v.14.1 Swift 5 Platform: iOS macOS v.12.6

lblazquezg avatar Nov 09 '22 11:11 lblazquezg

@danielgindi @liuxuan30 @pmairoldi We are facing this same crash. Is there any update on when the PR to resolve this (#4981) will me merged and made available in a release?

geoffclifton avatar Mar 02 '23 14:03 geoffclifton

Hi! This error still persists in version 5.0.0. Is there any update regarding it? Thanks

lblazquezg avatar Aug 22 '23 09:08 lblazquezg

Hi, we're still encountering this crash as well. Looks like over 100 crashes in production over the past 90 days. Are there any updates on a solution? Thanks!

jonduenas avatar Dec 04 '23 17:12 jonduenas

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

leCandas avatar Apr 15 '24 07:04 leCandas