Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Mapbox crashes after it fails to load compiled Shaders #14041

Closed
AhiyaHiya opened this issue Mar 6, 2019 · 7 comments
Closed

Mapbox crashes after it fails to load compiled Shaders #14041

AhiyaHiya opened this issue Mar 6, 2019 · 7 comments
Labels
Android Mapbox Maps SDK for Android crash release blocker Blocks the next final release

Comments

@AhiyaHiya
Copy link

AhiyaHiya commented Mar 6, 2019

Mapbox Shader compiler does not check if loading precompiled binaries fail

Steps to reproduce

  1. Set up original Android release, or at least Android 8.0, on Samsung S9 device
  2. Install test-application onto Samsung S9
  3. Run test-application and observe loading and operation
  4. Close test-application
  5. Restart Samsung phone
  6. Upgrade Samsung S9 device to “One UI/Android 9 Pie” update
  7. Run test-application and observe loading; review crash logs

Expected behavior

Mapbox identifies that it was unable to load cached compiled Shader binaries and attempts recompiling Shader code.

Actual behavior

Application crashes when attempting to call com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onDrawFrame

Configuration

Android versions:
Android 8.0
Android 9 and One UI Version 1.0

Device models:
Samsung Galaxy S9+

Mapbox SDK versions:
Mapbox 5.2.0 or later

logcat_filtered.txt

AndroidRuntime: FATAL EXCEPTION: GLThread 6419 AndroidRuntime: Process: com.myapp.testapplication, PID: 20199 AndroidRuntime: java.lang.Error: end of buffer exception AndroidRuntime: at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.nativeRender(Native Method) AndroidRuntime: at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onDrawFrame(SourceFile:90) AndroidRuntime: at com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onDrawFrame(SourceFile:55) AndroidRuntime: at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571) AndroidRuntime: at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)

@AhiyaHiya
Copy link
Author

AhiyaHiya commented Mar 6, 2019

Workaround

Forcing Mapbox to recreate the Shader binary requires deleting the contents of the application cache folder, using either:

  • In Android, Settings > Apps & Notifications > [YOUR_APP] > Storage > “Clear cache”
  • adb exec-out run-as com.myapp.testapplication rm -rf /data/user/0/com.myapp.testapplication/cache

@tobrun tobrun added Android Mapbox Maps SDK for Android crash labels Mar 6, 2019
@tobrun
Copy link
Member

tobrun commented Mar 6, 2019

@tmpsantos can we harden shader loading in core?

@tmpsantos
Copy link
Contributor

@tmpsantos can we harden shader loading in core?

can you reproduce this issue? From the log the shader compiler reported the errors.

@bwuso
Copy link

bwuso commented Mar 28, 2019

@tmpsantos I'm also running into the same issue.

Mapbox SDK version:
Mapbox 5.4.1

Our app is showing around 40 users are experiencing the problem on Android 9 Pie with the following devices:

  • Galaxy S9
  • Galaxy S9+
  • Galaxy Note 9

Reproduction steps are similar:

  1. Open activity where we load a mapview with a style. (Currently using bingmaps raster tiles)
  2. Observe the map is loading
  3. Back out of the activity while map is still loading (sometimes a crash occurs after backing out)
  4. Load the same activity with different parameters and a crash occurs.
  5. Run application and attempt to launch activity again and a crash occurs.

Sometimes I get this bug:

2019-03-28 14:46:41.836 com.sample.android.uat.debug E/UncaughtException: java.lang.Error: unknown pbf field type exception
        at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.nativeRender(Native Method)
        at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onDrawFrame(MapRenderer.java:90)
        at com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onDrawFrame(GLSurfaceViewMapRenderer.java:55)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)

And sometimes it's this one:

2019-03-28 14:49:15.746 com.sample.android.uat.debug E/AndroidRuntime: FATAL EXCEPTION: Thread-20
    Process: com.sample.android.uat.debug, PID: 24214
    java.lang.Error: end of buffer exception
        at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.nativeRender(Native Method)
        at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onDrawFrame(MapRenderer.java:90)
        at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewMapRenderer.onDrawFrame(TextureViewMapRenderer.java:56)
        at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewRenderThread.run(TextureViewRenderThread.java:280)
2019-03-28 14:49:15.746 com.sample.android.uat.debug E/UncaughtException: java.lang.Error: end of buffer exception
        at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.nativeRender(Native Method)
        at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onDrawFrame(MapRenderer.java:90)
        at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewMapRenderer.onDrawFrame(TextureViewMapRenderer.java:56)
        at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewRenderThread.run(TextureViewRenderThread.java:280)
  • Also if I perform the workaround suggested by @AhiyaHiya and repeat the steps listed, I can get it into a broken state again.

@tmpsantos
Copy link
Contributor

@AhiyaHiya @bwuso do you have more than one map on your application? We found this after debugging: #14294

@zugaldia zugaldia added the release blocker Blocks the next final release label Apr 2, 2019
@bwuso
Copy link

bwuso commented Apr 2, 2019

@tmpsantos Yes, my application has around 2-3 mapviews loading at the same. Weird thing is that this issue only shows up in Crashlytics for Android 9 - Samsung devices. I was unable to reproduce the issue on a Pixel 3 XL (os 9) test device.

@tmpsantos
Copy link
Contributor

@bwuso fixed by #14298

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android crash release blocker Blocks the next final release
Projects
None yet
Development

No branches or pull requests

5 participants