Charts: EXC_BREAKPOINT on LineChartRenderer.drawCircles

Created on 28 Jun 2019  ·  21Comments  ·  Source: danielgindi/Charts

I need to show Line graphs. I use regular API of Charts to show any graph, and it works perfectly in most case, but i receive in crashlyhtics some errors:

Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x00000001060e9ad4

Crashed: com.apple.main-thread
0 Charts 0x1060e9ad4 LineChartRenderer.drawCircles(context:) + 108 (BarLineScatterCandleBubbleRenderer.swift:108)
1 Charts 0x106052f44 BarLineChartViewBase.draw(_:) + 237 (BarLineChartViewBase.swift:237)
2 Charts 0x106053f9c @objc BarLineChartViewBase.draw(_:) ()
3 UIKitCore 0x1edade560 -[UIView(CALayerDelegate) drawLayer:inContext:] + 460
4 QuartzCore 0x1c53395c4 -[CALayer drawInContext:] + 296
5 QuartzCore 0x1c521d970 CABackingStoreUpdate_ + 176
6 QuartzCore 0x1c53400d0 invocation function for block in CA::Layer::display_() + 52
7 QuartzCore 0x1c5338e88 -[CALayer _display] + 1520
8 QuartzCore 0x1c52a1388 CA::Context::commit_transaction(CA::Transaction) + 532
9 QuartzCore 0x1c52cf330 CA::Transaction::commit() + 640
10 QuartzCore 0x1c52cff20 CA::Transaction::observer_callback(__CFRunLoopObserver
, unsigned long, void*) + 92
11 CoreFoundation 0x1c0e165f8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
12 CoreFoundation 0x1c0e11320 __CFRunLoopDoObservers + 412
13 CoreFoundation 0x1c0e1189c __CFRunLoopRun + 1228
14 CoreFoundation 0x1c0e110b0 CFRunLoopRunSpecific + 436
15 GraphicsServices 0x1c301179c GSEventRunModal + 104
16 UIKitCore 0x1ed647978 UIApplicationMain + 212
17 Easynvest 0x104ac72d4 main + 17 (main.swift:17)
18 libdyld.dylib 0x1c08d68e0 start + 4

Charts Environment

Charts version/Branch/Commit Number: 3.3.0
Xcode version: 10.2.1
Swift version: Swift 5
Platform(s) running Charts: IOS
macOS version running Xcode: 10.14.5

Unfortunally i dont have any scenario to reproduce this, any idea how to solve this problem?

bug

All 21 comments

I have the same issue ... I am still trying to reproduce it in my test environment.

The crash starts to appear after updating the library from 3.2.2 to 3.3.0 (for fixing the issue 3915 )

Any advance in this?

Crashed: com.apple.main-thread
0 Charts 0x1060e9ad4 LineChartRenderer.drawCircles(context:) + 108 (BarLineScatterCandleBubbleRenderer.swift:108)
1 Charts 0x106052f44 BarLineChartViewBase.draw(:) + 237 (BarLineChartViewBase.swift:237)
2 Charts 0x106053f9c @objc BarLineChartViewBase.draw(:) ()

can you post the crash reason? and maybe debug a little?

Having a similar issue, however it seems to be related to scatter charts in my case.

Xcode Debugger:
Screen Shot 2019-09-03 at 15 26 19

Firebase Crashlytics:
Screen Shot 2019-09-03 at 15 27 11

I need the crash reason, not just the stack. Can you send it?

@caloon seems you can reliably reproduce it? Can you send a code snippet so I can reproduce with ChartsDemo?

No, the issue did not occur when testing the app on my test device and I was not able to reproduce the issue. Only thing I have is the stack trace I received through Crashlytics and Xcode Debugger.

then it's not easy to know where's the fault. Do you have line number for the crash?

I referenced this issue in #4132 and explained what - in my opinion - caused the issue. Furthermore, bug reporter shows the issue occurs in the method drawValues(context:). Easiest would be to revert the tiny "improvements" referenced in #4132 which caused the framework's stability to collapse.

The way I see it, version 3.2.1 is the last stable build and I would strongly discourage anyone from using a newer version if they want to release a stable app. This is a serious issue that caused 5% of my users to experience crashes.

I will use this thread for discussion.
In #4132 you mentioned https://github.com/danielgindi/Charts/pull/3164, however this is merged into 4.0 branch, not master, so I don't think this would cause an issue for the official release.

for https://github.com/danielgindi/Charts/pull/3891, you claim it's adding more issues, however I didn't see a clear reason that this new iterator is causing OOB issue, or, I don't know what to fix. #3891 is using a default iterator as it said

I would like to fix it if any, asap, however so far I don't have a clue what is causing your crash.

And, @caloon your crash is in scatter chart renderer, seems you can reproduce it? I need to reproduce it.

This poster crashes at

0 Charts 0x1060e9ad4 LineChartRenderer.drawCircles(context:) + 108 (BarLineScatterCandleBubbleRenderer.swift:108)

which is different than yours, however both methods has

for j in _xBounds

with blind guess that if we suspect #3891 is the trouble, at least we need to know what's crashing.

and to everyone has similar crash, all I need is a reliable way to reproduce, if you find it's a rising crash rate. however so far we don't get one. The crash log is still hard to find what's wrong.

If it's a very small portion, could it be some corner cases on your side? I tried single data entry and zero data entry, no crash for line chart and scatter chart.

And if you manage to find the crash, the fix could be very fast and merged so I could release a new version this week.

I was able to cause this crash by feeding in data with x Values out of order

@liuxuan30 it seems min is 98 and max is 1 which breaks the iterator
image

why it's causing the min and max the contrary?

Hi @liuxuan30 Have you found the solution of this.I am also getting the same error.

@liuxuan30 Hi I am also getting this error now on the production app but I am unable to replicate it. Same error tho

Screenshot 2020-08-25 at 10 53 45
This is the stack trace

Hope this isn't a red herring.

I was getting this error, 100% reproducible in 3.5.0, XCode 12 beta.
Fixed it after an embarrassingly long time by manually forcing recalculation of min and max for my data set and the chart data.

        self.downloadDataSet.append(newThroughtputPoint)
        self.downloadDataSet.calcMinMax()
        chartView.data?.calcMinMax()
        self.chartView.notifyDataSetChanged()

I don't understand what it is even doing in drawCircles though, since I have them disabled.

if you append, did you sort? Or is it related unsorted values to crash? It has been a long time for this and honestly I'm not sure what's the issue now

Any update to this issue ?

Was this page helpful?
0 / 5 - 0 ratings