-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Crashes in MGLMapView.mm line 961 [MGLMapView glkView:drawInRect:] #11910
Comments
@cirlam Thanks for the report — please add the Mapbox SDK version that you’re using to the original post. 🙇 Any ideas, @ivovandongen? |
Sure - all updated. (iOS Mapbox SDK 3.7.7) |
I've had another crash permeating from the same MGLMapView.mm line 961, but resulting in a slightly different stack trace. I'm assuming they're the same issue - perhaps it helps to see both. Same MapBox iOS SDK as above, this one failed on an iPhone 8.1 Plus, iOS 11.3.1. Also worth noting that on all the crashes seen, there is less than 100mb free ram available (ranges from 64mb to 88mb).
|
@cirlam Are you able to reproduce this crash yourself? If there's a known way to reproduce the issue, it's likely we can fix it, but if the stack trace is all the information we have to go on, it's much less likely. |
Hi, not yet - although I must admit I haven't tried too hard yet. I believe (from Crashlytics Logs I built in last week) that this problem occurs when the app is brought to the foreground after being in the background recording a cycle ride for some time. I did have a idea today (not yet tested - will try it this evening), that perhaps I am referencing my mapView wrong: My guess is that my weak reference is allowing the mapView object to get deallocated under memory pressure. From looking at the mapbox sample apps, it looks like the correct way to reference the map is like this: Do you think this could be the issue? |
I have fixed my weak reference, but that has not solved the issue. I have been able to recreate the problem - to visually show the speed of the bike rider on the route they take, I use lots of polylines to simulate a gradient polyline. I am carefully watching this. When it's implemented on iOS and Android I'll be updating to use the proper gradient SDK - but for the time being I'm using a new polyline every time the speed changes by a certain value. When creating approx 4200 polylines (1 every second for 70 minutes), it crashes with EXC_BAD_ACCESS. At this point, the memory usage of the app isn't crazy at about 160mb - and the app's "didReceiveMemoryWarning" is not being fired. I intend to run some more tests this evening, with Zombie objects turned on etc - but is there a limit on the number of polylines the iOS SDK can handle? My android app hasn't suffered from this problem. I have updated my app to use Mapbox iOS SDK 4.0.1 and this test was on an iPhone 6, running iOS 11.3.1 |
Found the problem - I was updating the parameters of a Polyline object from a background thread. After updating the parameters of the Polyline object (still on the background thread), I created a copy of this Polyline object, ready to then display on the map view after I transitioned back to the main thread. Fixed by using my own class within the background thread like this. The class doesn't have any link to the map view, and implements NSCopying, to give the option of performing a deep copy.
Once I transition to the main thread, I now populate the map with poly lines like this:
(CustomPolyline is a subclass of MGLPolyline, with a color property) |
Great, glad you were able to find the issue! |
Hi,
Had a couple of my users experience the following issue on iPhone 6, iOS 11.3.1. I'm not sure what exactly is happening on the app at time of crash, but maybe the stack trace makes more sense to you?
Edit: iOS MapBox SDK 3.7.7
The text was updated successfully, but these errors were encountered: