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

Overlapping map views rendering crashes #9534

Closed
ghost opened this issue Jul 18, 2017 · 6 comments
Closed

Overlapping map views rendering crashes #9534

ghost opened this issue Jul 18, 2017 · 6 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@ghost
Copy link

ghost commented Jul 18, 2017

In our current application, the user can see POIs around a location with a listing or a map. He can also select the location around which he wants to see POIs using a map in a bottom sheet.

Because of this, we may have two maps visible on screen and they can overlap. This triggers some weird rendering issues where the data of the background map is drawn over the bottom sheet one, and eventually the app crashes.

Here are two walkthrough in our app to explain the context and how the issue occurs:

Walkthrough 1

  1. Show the POIs map
  2. Hide it to show the bottom sheet without issue
  3. Show the bottom sheet map
  4. Show the two together
  5. Crash

Walkthrough 2

  1. Show the POIs map
  2. Show the bottom sheet map
  3. The background map is drawn over the bottom sheet one
  4. Hide and show the bottom sheet map
  5. Crash

Here is the stacktrace:

E/AndroidRuntime: FATAL EXCEPTION: main
                                                                       Process: our.app.package, PID: 26446
                                                                       java.lang.Error: eglSwapBuffers() failed
                                                                           at com.mapbox.mapboxsdk.maps.NativeMapView.nativeRender(Native Method)
                                                                           at com.mapbox.mapboxsdk.maps.NativeMapView.render(NativeMapView.java:179)
                                                                           at com.mapbox.mapboxsdk.maps.MapView.onDraw(MapView.java:407)
                                                                           at android.view.View.draw(View.java:17185)
                                                                           at android.view.View.updateDisplayListIfDirty(View.java:16167)
                                                                           at android.view.View.draw(View.java:16951)
                                                                           at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
                                                                           at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
                                                                           [...]

This seems related to #6647 and maybe #8725

Device:

Android 7.1.2
Nexus 5X

Mapbox SDK version:

Mapbox 5.0.1, upgraded to 5.1.0 and still getting crashes

Steps to trigger behavior

  1. Have a map view
  2. Open a bottom sheet containing another map view on top of the other one

Expected behavior

The bottom sheet map view should render above the other one without problem.

Actual behavior

The map view in the background is rendered on top of the bottom sheet one and the app crashes.

@boundsj boundsj added the Android Mapbox Maps SDK for Android label Jul 18, 2017
@tobrun
Copy link
Member

tobrun commented Jul 18, 2017

PR addressing this issue in #9538, would you be able to retest this with an upcoming 5.1.1 release?

@ghost
Copy link
Author

ghost commented Jul 19, 2017

Thank you for this quick answer. I will test it when the 5.1.1 is available and let you know if it's indeed solving it. What is the ETA for the 5.1.1?

@ghost
Copy link
Author

ghost commented Jul 19, 2017

I tested it by compiling Mapbox on the branch 9458-port-backendscope-changes and using it in our app.

The instant crash is gone. The rendering of the background map is still occurring on top of the bottom sheet one.

After some manipulations, another crash occurs sometimes with eglMakeCurrent() failed, but I can't reproduce it consistently.

@tobrun
Copy link
Member

tobrun commented Jul 19, 2017

The instant crash is gone. The rendering of the background map is still occurring on top of the bottom sheet one.

The issue here is that the overlapping SurfaceViews are fighting for the z order and the underlying surfaceview wins. There are two workarounds:

  • Make the bottom use a texture view (this can be enabled through xml or MapboxMapOptions)
    - set Z order on top for the surfaceview in the bottom fragment drawer by ((SurfaceView) mapview.findViewById(R.id.surfaceView)).setZorderOnTop(true)

@mesnault can you post a full stacktrace of that second crash?

@ghost
Copy link
Author

ghost commented Jul 19, 2017

Using a texture view for the bottom sheet map is indeed fixing the rendering issue. The method is deprecated on the MapboxMapOptions, so it might disappear someday, I guess?

Setting the Z order on top for the underlying surface view is making the markers on the map disappear, as the surface view is drawn above them.

can you post a full stacktrace of that second crash?

Sure, here it is. Note that I did not merge the branch 9458-port-backendscope-changes into any branch, so it might lack some recent changes.

07-19 14:51:52.508 18026 18026 E AndroidRuntime: FATAL EXCEPTION: main
07-19 14:51:52.508 18026 18026 E AndroidRuntime: Process: our.app.package, PID: 18026
07-19 14:51:52.508 18026 18026 E AndroidRuntime: java.lang.Error: eglMakeCurrent() failed
07-19 14:51:52.508 18026 18026 E AndroidRuntime:        at com.mapbox.mapboxsdk.maps.NativeMapView.nativeRender(Native Method)
07-19 14:51:52.508 18026 18026 E AndroidRuntime:        at com.mapbox.mapboxsdk.maps.NativeMapView.render(NativeMapView.java:179)
07-19 14:51:52.508 18026 18026 E AndroidRuntime:        at com.mapbox.mapboxsdk.maps.MapView.onDraw(MapView.java:407)
07-19 14:51:52.508 18026 18026 E AndroidRuntime:        at android.view.View.draw(View.java:17185)
07-19 14:51:52.508 18026 18026 E AndroidRuntime:        at android.view.View.updateDisplayListIfDirty(View.java:16167)
07-19 14:51:52.508 18026 18026 E AndroidRuntime:        at android.view.View.draw(View.java:16951)
07-19 14:51:52.508 18026 18026 E AndroidRuntime:        at android.view.ViewGroup.drawChild(ViewGroup.java:3727)
07-19 14:51:52.508 18026 18026 E AndroidRuntime:        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3513)
[...]

We've decided to move to another UI to avoid displaying two maps together, since we cannot wait for the 5.1.1, so you might close this issue if you feel the problem is solved by #9538. Anyway, thank you for your time and your quick answers

@tobrun
Copy link
Member

tobrun commented Jul 24, 2017

adding here that 5.1.1 has shipped. I'm working now on reproducing the issue in #9534 (comment) but haven't been able to do so. To harden against future regressions I'm adding a similar setup to our testapp as shown in OP. Could you give some pointers on how yours setup differs from the setup in in #9592? This would help with reproducing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

2 participants