adventuregamestudio / ags

AGS editor and engine source code
Other
697 stars 160 forks source link

Android: newer / bigger games randomly crashing #863

Closed Jinx1337 closed 2 years ago

Jinx1337 commented 5 years ago

Technobabylon / Unawoved randomly crashing without an error. Seems completely random too (some sort of cache/buffer overflow?). Other than that, they're running perfectly without any hitches (tested on a Snapdragon 855 device). Tried messing with cache settings, disabled multithreading, checked the empty cache on room change in ini - same thing. Completely random app exits. Sometimes it works for 25 min, other times it quits in 5 min.

Jinx1337 commented 5 years ago

If it may be of any help, I found this thread from some years ago (crashes are very similar to what's in this thread: https://www.adventuregamestudio.co.uk/forums/index.php?topic=49207.msg636471807#msg636471807 ).

I will try to play around with logcat (tho I have a non-rooted S10+) and post the logs when I replicate it. For Unawoved, the game has weird characters stutter (not FPS nor emulation related) - characters take slight pause whenever the footstep sound is being played. Disabling threaded audio fixes the slowdowns, but crashes occur nevertheless.

ghost commented 5 years ago

Disabling threaded audio fixes the slowdowns, but crashes occur nevertheless.

Threaded audio does not work safely before AGS 3.5.0. I completely forgot it could be enabled on Android, for example on Linux it was simply hardcoded to be always disabled. It could be at least one reason for crashing there. I will build 3.5.0 APK which has a safer threaded audio implemented finally.

Jinx1337 commented 5 years ago

I messed around with logcat reader (not sure if I'm doing it correctly). The last 'error' I got from AGS before crashing (and good 30-40 mins after starting Unawoved this time) was:

<<< log_count = 2 >>> [07-05 16:11:05.714 9097:9097 E/AppInfoDashboard] Package: com.bigbluecup.android.launcher not found for user: 150

[07-05 16:11:10.235 9097:9097 E/AppStorageSettings] Could not find package android.content.pm.PackageManager$NameNotFoundException: com.bigbluecup.android.launcher at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:266) at com.android.settings.applications.AppStorageSettings.isSDcardMoveAvailable(AppStorageSettings.java:923) at com.android.settings.applications.AppStorageSettings.onResume(AppStorageSettings.java:208) at android.app.Fragment.performResume(Fragment.java:2568) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1341) at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1576) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1637) at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3050) at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3012) at android.app.FragmentController.dispatchResume(FragmentController.java:205) at android.app.Activity.performResume(Activity.java:7580) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3999) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4039) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1947) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7032) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

Does that make any sense? Or do I have to look for something else? Also - sometimes it crashes 30 seconds into the game, sometimes 40. No way to replicate it AFAIK and I'm testing extensively.

I also got the same crash with Kings Quest II Romancing the Stones (remake) today.

Jinx1337 commented 5 years ago

New one from just before - full log attatched. Interesting part (I believe): [07-05 17:42:54.326 1522:1580 E/WindowManager] RemoteException occurs on reporting focusChanged, w=Window{fadeaad u0 com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine} android.os.DeadObjectException at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(Binder.java:1140) at android.view.IWindow$Stub$Proxy.windowFocusChanged(IWindow.java:500) at com.android.server.wm.WindowState.reportFocusChangedSerialized(WindowState.java:3894) at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:5442) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:214) at android.os.HandlerThread.run(HandlerThread.java:65) at com.android.server.ServiceThread.run(ServiceThread.java:44)

logcat_07-05-2019_17-44-48 (1).txt

Jinx1337 commented 5 years ago

And another one from just now, with I believe some interesting tidbid:

[07-05 17:53:31.768 1522:3867 V/WindowManager] Remove Window{4d8bc66 u0 com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine}: mSurfaceController=Surface(name=com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine[15101])/@0xc6a43fd mAnimatingExit=false mRemoveOnExit=false mHasSurface=true surfaceShowing=true isAnimationSet=false app-animation=false mWillReplaceWindow=false inPendingTransaction=false mDisplayFrozen=false callers=com.android.server.wm.WindowState.access$300:281 com.android.server.wm.WindowState$DeathRecipient.binderDied:3333 android.os.BinderProxy.sendDeathNotice:1206

[07-05 17:53:31.768 813:813 I/Layer] id=2881 onRemoved SurfaceView - com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine@e8b59d2@0[15101]#0

[07-05 17:53:31.768 813:813 I/Layer] id=2882 onRemoved Background for -SurfaceView - com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine@e8b59d2@0[15101]#0

[07-05 17:53:31.768 1522:3867 I/WindowManager] Destroying surface Surface(name=com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine[15101])/@0xc6a43fd called by com.android.server.wm.WindowStateAnimator.destroySurface:1903 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:838 com.android.server.wm.WindowState.removeImmediately:2704 com.android.server.wm.WindowState.removeIfPossible:2854 com.android.server.wm.WindowState.access$300:281 com.android.server.wm.WindowState$DeathRecipient.binderDied:3333 android.os.BinderProxy.sendDeathNotice:1206

[07-05 17:53:31.769 813:2381 I/SurfaceFlinger] id=2874 Removed com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine[15101]#0 (0/64)

[07-05 17:53:31.769 1522:2101 I/ActivityManager] Process com.bigbluecup.android.launcher (pid 15101) has died: fore TOP (780,3034)

[07-05 17:53:31.770 1522:3853 D/EdgeLightingManager] hideForWakeLock packageName=com.bigbluecup.android.launcher

[07-05 17:53:31.770 1522:3853 D/EdgeLightingPolicyManager] isAcceptableApplication: pkg=com.bigbluecup.android.launcher , range=4 , includeAllApp=false , userId=0 , infoRange=0 , infoCategory=0

[07-05 17:53:31.771 1522:2101 I/am_proc_died] [0,15101,com.bigbluecup.android.launcher,0,2,780,3034]

[07-05 17:53:31.772 1522:2101 W/ActivityManager] Force removing ActivityRecord{c146dbc u0 com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine t1826}: app died, no saved state

[07-05 17:53:31.772 1522:2101 I/am_finish_activity] [0,202665404,1826,com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine,proc died without state saved]

[07-05 17:53:31.777 813:2381 I/SurfaceFlinger] id=2873 Removed 4d8bc66 com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine#0 (1/63)

[07-05 17:53:31.779 1522:3867 V/WindowManager] Changing focus from Window{4d8bc66 u0 com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine} to null Callers=com.android.server.wm.WindowState.removeIfPossible:2860 com.android.server.wm.WindowState.access$300:281 com.android.server.wm.WindowState$DeathRecipient.binderDied:3333 android.os.BinderProxy.sendDeathNotice:1206


[07-05 17:50:50.303 813:813 I/SurfaceFlinger] Display 0 HWC layers: type | handle | flag | format | source crop (l,t,r,b) | frame | name ------------+--------------+------+-----------+----------------------------+---------------------+------ Device | 0x7cefa398a0 | 0002 | 0x0000115 | 0.0 0.0 1080.0 1920.0 | 0 188 1440 2748 | SurfaceView - com.bigbluecup.android[...]android.AgsEngine@6146f21@0[14806]#0 SolidColor | | 0000 | Unknown | 0.0 0.0 -1.0 -1.0 | 0 0 1440 3040 | Dim Layer for - Task=1825#0 Device | 0x7cef22da80 | 0000 | RGBA_8888 | 0.0 0.0 1440.0 192.0 | 0 2848 1440 3040 | NavigationBar[2000]#0

[07-05 17:50:50.344 1522:1735 W/InputDispatcher] channel 'c837dad com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine (server)' ~ Consumer closed input channel or an error occurred. events=0x9, fd=625

[07-05 17:50:50.344 1522:1735 E/InputDispatcher] channel 'c837dad com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine (server)' ~ Channel is unrecoverably broken and will be disposed!

Please tell me if I am helping by any chance, or just spamming :) logcat_07-05-2019_17-55-47.txt

ericoporto commented 5 years ago

@Jinx1337 I got a SDM845 phone, and I could reproduce the random crash (it takes a long time, around 40 min, for me to get one though) on my own game using 3.4.3.1

2019-07-09 20:14:49.907 19743-19770/com.mythsuntold.futureflashback W/futureflashbac: 0xebadde09 skipped times: 0
2019-07-09 20:14:49.910 19743-19770/com.mythsuntold.futureflashback A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x5e5c in tid 19770 (Thread-5), pid 19743 (futureflashback)

and

2019-07-09 19:24:17.483 6128-6378/com.mythsuntold.futureflashback W/futureflashbac: 0xebadde09 skipped times: 0
2019-07-09 19:24:17.486 6128-6378/com.mythsuntold.futureflashback A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x5d50 in tid 6378 (Thread-5), pid 6128 (futureflashback)

I profiled too and there was no RAM spike or nothing else that looked suspicious. There is nothing special on the action, both were just with the character walking - but my character makes stepping sounds when he walks.

I couldn't reproduce it on the 3.5.0.14 build so far.

I wonder if this is just #82 and #275 .

Jinx1337 commented 5 years ago

Curious. Could you provide me with the newer build?

Im using 3.4.4 by CrimsonWizard with the achievments stubb plugin fix.

I would like to test it some more.

ghost commented 5 years ago

@Jinx1337 here's a 3.5.0.14 build (or rather made of latest release-3.5.0 branch): https://www.dropbox.com/s/t5qcscn803j5kyk/AGS-3.5.0.14.apk?dl=0

threaded audio is supposed to work better there. Can't predict what happens to "hardware" gfx mode because people were saying it's still not working on many devices.

ericoporto commented 5 years ago

@Jinx1337 can you do a test for me? I don't know exactly how you are running these games, but could you try editing two files? On your android.cfg, do under sound, set threaded to 0.

[sound]
threaded = 0

And on your acsetup.cfg file, under sound, also do threaded 0, and under override, multitasking to 0 too.

[sound]
threaded = 0
[override]
multitasking = 0

Then save and try to play the games and see if the crashes still occurs.

ghost commented 5 years ago

@ericoporto how does multitasking mode affects playing on Android?

ericoporto commented 5 years ago

This is guesswork. For whatever reason, I don't have crashes on my devices. I imagined that those crashes should happen on Linux too, since the threaded audio code is the same, but they don't happen on it either.

I don't think multitasking is needed but since the answers take some time, it's better to isolate and then relax the guesses :] If the crashes still happen, then it's something else.

Jinx1337 commented 5 years ago

Will do.

Ill report back in the evening or tomorrow morning.

I usually disable threaded audio in AGSes GUI, but ill do that through config files as well.

Jinx1337 commented 5 years ago

Unawoved just crashed on me :(

Will try TechnoBabylon soon and maybe QfG2

Jinx1337 commented 5 years ago

TechnoBabylon crashed as well.

Jinx1337 commented 5 years ago

channel '4212aa9 com.bigbluecup.android.launcher/com.bigbluecup.android.AgsEngine (server)' ~ Channel is unrecoverably broken and will be disposed!

ericoporto commented 5 years ago

Does Whispers of a Machine and Kathy Rain official Android ports work for you?

Jinx1337 commented 5 years ago

Yes, the official ports work well. I'll try a playthrough of Whispers today and see if there is no crash during a longer playthrough just to make sure.

ericoporto commented 5 years ago

I am using 3.5.0.14 on the game below:

https://play.google.com/store/apps/details?id=com.mythsuntold.teafortwo

This other AGS game uses 3.4.1.11:

https://play.google.com/store/apps/details?id=com.tomsimpson.huttonvga

If you could try. If you only have problems on games that are not specifically made to run on Android, then it could be something else, if it's really random, then it's not something like file system access, or triggering Steam achievement, or pooling for joysticks, but then I don't know what the problem is.

ghost commented 5 years ago

These error messages - SIGSEGV, SEGV_MAPERR, are indicating memory errors, like trying to access a bad pointer. TBH my main concern here is why these errors do not reproduce on desktop platforms; is it in the code specific to Android or just bad luck.

Jinx1337 commented 5 years ago

What I've observed so far is that every game crashed eventually; the ones more complex do it more often.

Attaching log of my last Unawoved crash. logcat_07-11-2019_15-57-24.txt

Just had a crash in A Tale of Two Kingdoms Deluxe.

Jinx1337 commented 5 years ago

So far no crashes in Whispers. Will test some more...

Jinx1337 commented 5 years ago

Nope. No crashes at all. Played for 3 hours straight.

ghost commented 5 years ago

You mean, you were running their own ports?

KR and WoaM developer has published their custom engine sources on github earlier, Although they are based on older version of AGS, maybe we could still compare them to see if they changed anything critical. (Then again, maybe a new bug was introduced since)

Jinx1337 commented 5 years ago

Yes, I tried the official ports. I would love to see the Android AGS port running correctly, since other than that rather critical issue, it runs flawlessly.

ghost commented 5 years ago

@Jinx1337 something I forgot to ask earlier, have you tried hardware gfx mode on their ports and if it works for you?

Jinx1337 commented 5 years ago

There is no option for choosing the Render mode in any of the official ports AFAIK. Unfortunately, my phone cannot be rooted yet so no access to eventual config files either. Also, hardware mode doesnt run on the newest AGS apk (black screen) that you posted here.

Jinx1337 commented 5 years ago

I take it there's no further development in this regard?

It is sad, as this rather critical issue completely wrecks an otherwise perfect port... :( I'm willing to test if help is required.

Jinx1337 commented 5 years ago

Was there any new svn version released that I might check and see if there is any inprovement?

ivan-mogilko commented 3 years ago

@Jinx1337 I think you mentioned on AGS forums that the new Android port based on SDL2 version does not crash for you?

In any case, there's a big change and this problem has to be retested with the 3.6.0 engine.

ivan-mogilko commented 2 years ago

I think this may be closed as probably fixed. A new case would have to be opened if something is wrong within v3.6.0, as it has a new backend, new android player, and certain engine fixes that may have also affected this.