Skip to content

ANR on suspend: CoronaActivity blocks in GLSurfaceView.surfaceDestroyed after recent OS update #843

@marksolar2d

Description

@marksolar2d

Steps to Reproduce

Create a minimal Solar2D project with only:

Runtime:addEventListener("system", function(e) print("system", e.type) end)

Build and install on a Pixel 8 running the September 2025 Android update.

Launch the app.

Press the power button to sleep the device.

Wait ~2–3 seconds, then unlock.

Expected

App receives applicationSuspend and applicationResume.

Process stays alive, like on other devices / OS versions.

Actual

No applicationSuspend is logged.

After ~5 seconds:

W/ActivityTaskManager: Activity pause timeout for CoronaActivity
I/ActivityManager: Process com.solar2d.app.test has died: fg TOP

App cold-starts on resume.

ANR Trace

Excerpt from /data/anr/traces.txt (main thread):

"main" prio=5 tid=1 Waiting
  at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.surfaceDestroyed(GLSurfaceView.java:1735)
  - locked <0x0ef389d0> (a com.ansca.corona.graphics.opengl.GLSurfaceView$GLThreadManager)
  at com.ansca.corona.CoronaActivity.onPause(CoronaActivity.java:??)

Notes

Unity apps suspend/resume correctly on the same device.

Solar2D currently blocks the UI thread waiting for GL teardown, which now triggers the stricter ANR watchdog on Android 15.

Suggested Fix

Rework CoronaActivity → GLSurfaceView.surfaceDestroyed() handling.

Avoid blocking the UI thread in onPause; delegate GL teardown to the GL thread or defer until resume.

Similar approach already used by Unity and other engines to survive Android 14/15 lifecycle changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions