Crash reports from the field indicate a huge increase in certain crashes since our update to 100.7 from 100.6
All of this is in ArcGIS code. No, I can't give code to reproduce it but it is common from crash reports.
What I am hoping for are some insights.
What could trigger this?
What argument is out of range?
What argument is invalid?
I can't know those things without the source code.
How I can make them in range and valid?
Fatal Exception: com.esri.arcgisruntime.ArcGISRuntimeException: Out of range
at com.esri.arcgisruntime.internal.jni.CoreGeoView.nativeDraw(SourceFile)
at com.esri.arcgisruntime.internal.jni.CoreGeoView.a(SourceFile:346)
at com.esri.arcgisruntime.internal.h.b.o.a(SourceFile:132)
at com.esri.arcgisruntime.mapping.view.MapView.onDrawFrame(SourceFile:156)
at com.esri.arcgisruntime.mapping.view.GeoView$b.onDrawFrame(SourceFile:1363)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1575)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1271)
Fatal Exception: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid argument
at com.esri.arcgisruntime.internal.jni.CoreMapView.nativeInteractionDrag(SourceFile)
at com.esri.arcgisruntime.internal.jni.CoreMapView.a(SourceFile:304)
at com.esri.arcgisruntime.internal.h.b.o.b(SourceFile:186)
at com.esri.arcgisruntime.mapping.view.MapView.drag(SourceFile:980)
at com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener$b.run(SourceFile:215)
at java.util.TimerThread.mainLoop(Timer.java:562)
at java.util.TimerThread.run(Timer.java:512)
Caused by com.esri.arcgisruntime.ArcGISRuntimeException: Invalid argument
at com.esri.arcgisruntime.internal.jni.CoreMapView.nativeSetMap(SourceFile)
at com.esri.arcgisruntime.internal.jni.CoreMapView.a(SourceFile:215)
at com.esri.arcgisruntime.internal.h.b.o.a(SourceFile:448)
at com.esri.arcgisruntime.mapping.view.MapView.setMap(SourceFile:594)
To narrow down the issue it would be helpful to have some questions answered please. What models of devices are you seeing this on? What operating system versions are they running? What kind of data are you showing in your maps? Any insight to help us narrow down the issue and reproduce it would be helpful.
Various devices, but many are Samsung Tablets. Android 8,9,10
They are in the field, typically without network.
They are using an offline map., which means the basemap contains a subclass of ImageTiledLayer.
Map is moving with LocationDisplay using Moving direction.
The map may have 1-5 GraphicsOverlays which contain polylines and points.
In particular, one graphics overlay has a polyline that is frequently updated because they are recording there path.
Ie it is deleted from the GraphicsOverlay and replaced with a slightly longer polyline every few seconds.
User reported that the app crashed randomly four times in 66 miles of offroading.
Is it possible, for instance that the MapView handle is invalid because somehow the Activity isn't being garbage collected? I've been chasing down some leaks in Android Framework.
Just what is/could be invalid in those calls could help me track it down.
Hi Nathan,
Please can you confirm that you forward the pause/resume/destroy events from your Activity or Fragment to the MapView they show? Here is a sample of what this should look like:
arcgis-runtime-samples-android/MainActivity.kt at master · Esri/arcgis-runtime-samples-android · Git...
Also, since you are saying that these issues did not occur with the 100.6.0 SDK, has anything significant changed in your app code when you migrated to 100.7.0?
Gunther
There have always been some in our crash logs, and they have increased dramatically since the 100.7 rollout.
Users have noticed them consistently when using it for a few hours.
The other big change we made for 100.7 was to migrate from AppCompat to AndroidX, because this was required for 100.7.
These are the relevant portions.
Some things are in a slightly different order.
Notice that we have a whole lot more in OnDestroy than mMapView.dispose()
While they are things that dispose should probably handle, at some point in the past I had to add all of those to avoid memory leaks.
@Override protected void onPause() { Crashlytics.log("BCHomeActivity --> Start onPause ----"); mMapView.pause(); //.... super.onPause(); Crashlytics.log("BCHomeActivity --> End onPause ----"); } @Override protected void onResume() { Crashlytics.log("BCHomeActivity --> Start onResume ----"); super.onResume(); mMapView.resume(); Crashlytics.log("BCHomeActivity --> End onResume ----"); } @Override protected void onDestroy() { Crashlytics.log("BCHomeActivity --> Start onDestroy ----"); try { //unusubscribe listeners. mMapView.removeMapScaleChangedListener(this.mScaleChangedListener); mMapView.removeNavigationChangedListener(this.mNavChangedListener); mMapView.setOnTouchListener(new BCDummyTouchListener()); mMapView.getLocationDisplay().stop(); mMapView.dispose(); }catch(ArcGISRuntimeException e){ Crashlytics.log("BCHomeActivity --> onDestroy ----" + e.getMessage()); } //.... super.onDestroy(); Crashlytics.log("BCHomeActivity --> End onDestroy ----"); }
The code in your onPause/onResume/onDestroy methods looks correct.
I have tried a few scenarios to reproduce the exceptions you report above, but wasn't able to.
The `ArcGISRuntimeException: Invalid argument` exceptions have been observed in the past when a MapView is still referenced and called into after it has been disposed. Please double check that this isn't something that can occur in your code. In other words, make sure you don't hold on to the MapView after it has been disposed.
At this stage we can only debug this further if you could share some code or specific steps to reproduce these exceptions.
Gunther
I am putting the most time into trying to discover whether a Mapview is called after it is disposed.
There is evidence that some of this is happening after onDestroy.
However, the following is happening after onDestroy and it is not in my code:
Fatal Exception: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid argument
at com.esri.arcgisruntime.internal.jni.CoreMapView.nativeInteractionDrag(SourceFile)
at com.esri.arcgisruntime.internal.jni.CoreMapView.a(SourceFile:304)
at com.esri.arcgisruntime.internal.h.b.o.b(SourceFile:186)
at com.esri.arcgisruntime.mapping.view.MapView.drag(SourceFile:955)
at com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener$b.run(SourceFile:203)
at java.util.TimerThread.mainLoop(Timer.java:562)
at java.util.TimerThread.run(Timer.java:512)
I don't know why this would still be running after dispose.
This is the reason I tried to avoid it by inserting a Dummy Listener that does nothing.
I am also using LeakCanary to look for leaks preventing the Activity from being garbage collected. Here is one of them. It is pointing to a reference in native code.