cocos / cocos/cocos-engine

GameActivity onPauseNative ANR

Open
#17,511 7 comments 0 reactions 1 assignee View on GitHub

@bofeng-song is already working on this.

Since Aug 13, 2024.

Bug Env: Android Env: Native
Dominant language
C++
Stars
9.8k
Forks
2.1k
Avg merge
12h 42m
Merged PRs (30d)
13

Description

Cocos Creator version

3.6.1

System information

Android

Issue description

谷歌上反馈的,我们多个项目都这样。好像是Java那边的生命周期引起的ANR问题。

Relevant error log output

#00 pc 0x0000000000058240 /apex/com.android.runtime/lib64/bionic/libc.so (syscall+32)
#01 pc 0x000000000005d010 /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex+144)
此原生同步例程正阻塞主线程,进而导致 ANR。 了解详情

#02 pc 0x00000000000c9084 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_timedwait+132)
#03 pc 0x000000000059d200 /data/app/~~RdGOe_NFny5pNDRr00uz_w==/com.shooting.io.zombie.survival.gp-bx2OqzRBpX5AO6ZuJtir-A==/split_config.arm64_v8a.apk (android_app_set_activity_state+1892352) (BuildId: 08103d28bb7af9524a27fe99397919106b148089)
at com.google.androidgamesdk.GameActivity.onPauseNative (Native method)
at com.google.androidgamesdk.GameActivity.onPause (GameActivity.java:304)
at com.cocos.lib.CocosActivity.onPause (CocosActivity.java:138)
at com.cocos.game.AppActivity.onPause (AppActivity.java:544)
at android.app.Activity.performPause (Activity.java:8842)
at android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1661)
at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:5444)
at android.app.ActivityThread.performPauseActivity (ActivityThread.java:5405)
at android.app.ActivityThread.handlePauseActivity (ActivityThread.java:5357)
at android.app.servertransaction.PauseActivityItem.execute (PauseActivityItem.java:48)
at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:98)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2550)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:243)
at android.os.Looper.loop (Looper.java:338)
at android.app.ActivityThread.main (ActivityThread.java:8446)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:589)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1055)

Steps to reproduce

none

Minimal reproduction project

none

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.