Skip to content

Map shutdown ANR #3618

@adrian-cojocaru

Description

@adrian-cojocaru

MapLibre Android Version

11.8.8

Android SDK Version

Android 11

Device

Custom

What happened?

We're seeing some ANRs during map shutdown in a multi-map environment. When MapLibreSurfaceView.requestExitAndWait() is called during cleanup it waits for the RenderThread to exit and that seems to deadlock in eglDestroyContext.

Steps to reproduce

Unknown

Renderer

OpenGL (choose this if you are unsure)

Relevant log output

com.github.anrwatchdog.ANRError: Application Not Responding for at least 5000 ms.
Caused by: com.github.anrwatchdog.ANRError$$$_Thread: main (state = BLOCKED)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:442)
	at org.maplibre.android.maps.renderer.surfaceview.MapLibreSurfaceView$RenderThread.requestExitAndWait(MapLibreSurfaceView.java:440)
	at org.maplibre.android.maps.renderer.surfaceview.MapLibreSurfaceView.onDetachedFromWindow(MapLibreSurfaceView.java:253)
	at android.view.View.dispatchDetachedFromWindow(View.java:20536)
	at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3934)
	at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3934)
	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:5560)
	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:5531)
	at android.view.ViewGroup.removeView(ViewGroup.java:5462)

Thread : 16640/RenderThread 16640
	isAlive : true
	isInterrupted : false
	isDaemon : false
		at com.google.android.gles_jni.EGLImpl.eglDestroyContext(Native Method)
		at org.maplibre.android.maps.renderer.egl.EGLContextFactory.destroyContext(EGLContextFactory.java:25)
		at org.maplibre.android.maps.renderer.surfaceview.MapLibreGLSurfaceView$EglHelper.finish(MapLibreGLSurfaceView.java:290)
		at org.maplibre.android.maps.renderer.surfaceview.MapLibreGLSurfaceView$GLThread.stopEglContextLocked(MapLibreGLSurfaceView.java:349)
		at org.maplibre.android.maps.renderer.surfaceview.MapLibreGLSurfaceView$GLThread.guardedRun(MapLibreGLSurfaceView.java:600)
		at org.maplibre.android.maps.renderer.surfaceview.MapLibreSurfaceView$RenderThread.run(MapLibreSurfaceView.java:284)

Additional context

No response

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions