Frequent Android Crashes

* This one affects almost all of my apps. Seems to be restricted to android versions from 7.0 and newer. Corona version somewhere between 2017.3114 - 2017.3157

signal 5 (SIGTRAP), code 1 (TRAP_BRKPT) backtrace: native: pc 00000000004cd104 /data/app/com.android.chrome-1/base.apk

Any news on this one?

I am seeing this also a lot on version 7 and above.

Best regards,

Bjoern

After a week (not really enough time, but…) on the 3169 build I’ve not yet seen the zn7*bitmap crash.  Not conclusive, just reporting.  FWIW, the things that have shown up so far are:

Build 2017.2169, #1 crash after a week: java.lang.UnsatisfiedLinkError: at java.lang.Runtime.loadLibrary (Runtime.java:367) at java.lang.System.loadLibrary (System.java:1076) at com.ansca.corona.JavaToNativeShim.\<clinit\> (JavaToNativeShim.java:115) at com.ansca.corona.CoronaEnvironment.setLuaErrorHandler (CoronaEnvironment.java:391) at com.ansca.corona.CoronaEnvironment.\<clinit\> (CoronaEnvironment.java:50) at com.ansca.corona.CoronaActivity.onCreate (CoronaActivity.java:230) at android.app.Activity.performCreate (Activity.java:6309) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1113) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2519) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2654) at android.app.ActivityThread.-wrap11 (ActivityThread.java) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1488) at android.os.Handler.dispatchMessage (Handler.java:111) at android.os.Looper.loop (Looper.java:207) at android.app.ActivityThread.main (ActivityThread.java:5728) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:789) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)

Build 2017.2169, #1 ANR after a week: Broadcast of Intent { act=android.intent.action.SCREEN\_OFF flg=0x50000010 VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} (has extras) } (no location available) "main" tid=1 Native "main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 obj=0x76f18530 self=0xf4bf6500 | sysTid=9830 nice=-4 cgrp=default sched=0/0 handle=0xf72efd54 | state=S schedstat=( 0 0 0 ) utm=136 stm=88 core=2 HZ=100 | stack=0xff079000-0xff07b000 stackSize=8MB | held mutexes= native: pc 0000000000017694 /system/lib/libc.so (syscall+28) native: pc 000000000004016d /system/lib/libc.so (pthread\_join+124) native: pc 0000000000015b58 /data/app/com.dev.app-1/lib/arm/libopenal.so (alcDestroyContext+516) native: pc 0000000000008ed7 /data/app/com.dev.app-1/lib/arm/libalmixer.so (ALmixer\_Quit+230) native: pc 000000000011d53c /data/app/com.dev.app-1/lib/arm/libcorona.so (???) native: pc 000000000011f970 /data/app/com.dev.app-1/lib/arm/libcorona.so (???) native: pc 000000000012fa64 /data/app/com.dev.app-1/lib/arm/libcorona.so (???) native: pc 000000000002b6fc /data/app/com.dev.app-1/lib/arm/libcorona.so (???) native: pc 000000000002e9f8 /data/app/com.dev.app-1/lib/arm/libcorona.so (Java\_com\_ansca\_corona\_JavaToNativeShim\_nativeDone+28) native: pc 00000000001e367d /data/app/com.dev.app-1/oat/arm/base.odex (Java\_com\_ansca\_corona\_JavaToNativeShim\_nativeDone\_\_J+80) at com.ansca.corona.JavaToNativeShim.nativeDone (Native method) at com.ansca.corona.JavaToNativeShim.destroy (JavaToNativeShim.java:277) at com.ansca.corona.Controller.destroy (Controller.java:286) - locked \<0x04db8245\> (a com.ansca.corona.Controller) at com.ansca.corona.CoronaRuntime.dispose (CoronaRuntime.java:88) at com.ansca.corona.CoronaActivity.onDestroy (CoronaActivity.java:1732) at android.app.Activity.performDestroy (Activity.java:7103) at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1171) at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5045) at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5090) at android.app.ActivityThread.access$1700 (ActivityThread.java:222) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1855) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java:158) at android.app.ActivityThread.main (ActivityThread.java:7230) at java.lang.reflect.Method.invoke! (Native method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

both occur on a variety of devices and os versions, no obvious patterns there.

Reporting back on bitmap crash after a week+, it seems to be fix with 3169. Cheers @vlads.

[member=‘Fungrip’], thank you for kind words! I’m really glad to hear that it helped.

Another good news: it seems, we have tracked down and fixed, at least some probably most, of OpenAL related crashes in 3175.

[member=‘Sphere Game Studios’], [member=‘davebollinger’] and [member=‘Yoger Games’]. You all reported OpenAL related crashes as being on top of your lists. When making next release, please, use 3175 or later to see if your issues was fixed (or, at least decreased in relative numbers).

Cheers!

btw, kind words from me too re the bitmap crash (i wasn’t sure my results were “conclusive enough” yet to get too excited)

but this:  “we have tracked down and fixed, at least some probably most, of OpenAL related crashes in 3175.”

… has me jumping for joy even before trying it!  Even just the possibility that it’s finally resolved (it has haunted me long before google started penalizing for it) is a big deal.  I’ll definitely incorporate and test with next build/release, thanks!

Hey @vlad thanks for that… I will be pushing a build for one of my games tonight so I’ll feedback soon!

It seems that the chrome crashes are caused by admob.

https://groups.google.com/forum/#!topic/google-admob-ads-sdk/I6giN0VbVa0

Thankfully, there is a crash log posted.

@vlads, thanks for the openAL fix. Very much appreciated.

Unfortunately, I do have to report that your fix might have introduced a new issue. Using build 3175, I now get the following error messages in the console: 

17dTesting Error with clearing buffer from source: Invalid OperationWarning: audio error: Failed to clear buffer from source: Invalid Operation

and

Warning: audio error: Could not bind data to source: Invalid Operation

These errors/warnings are appearing in an intensive audio scene where a lot of fireworks are launching and exploding (so, a lot of launch sounds and explosion sounds). Now, if these errors/warnings are just warnings and caught exceptions and will NOT cause the app to crash on a device, then I am OK with that. (If one in 7 fireworks don’t go boom, I can live with that). However, if these issues will generally crash the app on the device, then it becomes a serious problem for me. Any insights on this issue?

Thanks

Luay

EDIT: I just re-tested the app with build 3169, and, to my horror, these errors appeared. So, it seems these errors have nothing to do with your fix. Are they the initial reason for all these crash reports in openAL? I have no idea.

Thank you for the report, I don’t think they’re are connected, but it is worth looking into. Thank you. It would be nice if you could provide a sample app where you are getting this errors, and submit a bug with them.

OK some some crashes have reduced which is great.  Here is a long stack trace (from today using 3175) which might help @vlad?

#00 pc 00000000000a2f94 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libopenal.so #01 pc 0000000000016874 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libopenal.so (alcCreateContext+436) #02 pc 0000000000005ff7 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libalmixer.so (ALmixer\_Init+214) #03 pc 000000000011f7fc /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #04 pc 00000000000fe0ac /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #05 pc 000000000000cc04 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #06 pc 000000000001ce18 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #07 pc 000000000000d050 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #08 pc 000000000000c35c /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #09 pc 000000000000d1c8 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #10 pc 00000000000055a0 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so (lua\_pcall+88) #11 pc 0000000000006ff8 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #12 pc 000000000000cc04 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #13 pc 000000000001ce18 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #14 pc 000000000000d050 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #15 pc 000000000000c35c /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #16 pc 000000000000d1c8 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so #17 pc 00000000000055a0 /data/app/com.spheregamestudios.spacecity-1/lib/arm/liblua.so (lua\_pcall+88) #18 pc 00000000000f59e8 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #19 pc 00000000000d7b80 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #20 pc 000000000012f540 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #21 pc 00000000001314f0 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #22 pc 000000000012f9f8 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #23 pc 0000000000130754 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #24 pc 000000000002b530 /data/app/com.spheregamestudios.spacecity-1/lib/arm/libcorona.so #25 pc 000000000094d24d /data/app/com.spheregamestudios.spacecity-1/oat/arm/base.odex

I have the same issue and have no luck fixing this? Did it fix for you, if yes how?

fyi, seems that 3175 has “helped” re openal/almixer, but isn’t completely fixed, still the #1 ANR with new build:  (bitmap stuff having been previously resolved)

Build 2017.3179 (Nov 24 2017 03:07:35) executing service org.davebollinger.dropstack/shared.google.play.services.base.PackageStateChangedService Example devices: Samsung Galaxy S5 (kltetfnvzw), 2048MB RAM, Android 6.0 bq Aquaris X (bardock), 3072MB RAM, Android 7.1 Samsung Galaxy Note8 (greatlte), 6144MB RAM, Android 7.1 Samsung Galaxy A7(2016) (a7xltechn), 3072MB RAM, Android 6.0 "main" tid=1 Native "main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 obj=0x75d64360 self=0xb48b6500 | sysTid=30665 nice=-4 cgrp=default sched=0/0 handle=0xb6fc6b4c | state=S schedstat=( 0 0 0 ) utm=84 stm=37 core=3 HZ=100 | stack=0xbe11a000-0xbe11c000 stackSize=8MB | held mutexes= #00 pc 0000000000017638 /system/lib/libc.so (syscall+28) #01 pc 000000000003fd35 /system/lib/libc.so (pthread\_join+124) #02 pc 0000000000015b58 /mnt/asec/org.davebollinger.dropstack-2/lib/arm/libopenal.so (alcDestroyContext+516) #03 pc 0000000000008ed7 /mnt/asec/org.davebollinger.dropstack-2/lib/arm/libalmixer.so (ALmixer\_Quit+230) #04 pc 000000000011d53c /mnt/asec/org.davebollinger.dropstack-2/lib/arm/libcorona.so (???) #05 pc 000000000011f970 /mnt/asec/org.davebollinger.dropstack-2/lib/arm/libcorona.so (???) #06 pc 000000000012fa64 /mnt/asec/org.davebollinger.dropstack-2/lib/arm/libcorona.so (???) #07 pc 000000000002b6fc /mnt/asec/org.davebollinger.dropstack-2/lib/arm/libcorona.so (???) #08 pc 000000000002e9f8 /mnt/asec/org.davebollinger.dropstack-2/lib/arm/libcorona.so (Java\_com\_ansca\_corona\_JavaToNativeShim\_nativeDone+28) #09 pc 00000000001dbff5 /data/dalvik-cache/arm/mnt@asec@org.davebollinger.dropstack-2@base.apk@classes.dex (Java\_com\_ansca\_corona\_JavaToNativeShim\_nativeDone\_\_J+80) at com.ansca.corona.JavaToNativeShim.nativeDone (Native method) at com.ansca.corona.JavaToNativeShim.destroy (JavaToNativeShim.java:277) at com.ansca.corona.Controller.destroy (Controller.java:286) - locked \<0x0641162d\> (a com.ansca.corona.Controller) at com.ansca.corona.CoronaRuntime.dispose (CoronaRuntime.java:88) at com.ansca.corona.CoronaActivity.onDestroy (CoronaActivity.java:1732) at android.app.Activity.performDestroy (Activity.java:7130) at android.app.Instrumentation.callActivityOnDestroy (Instrumentation.java:1171) at android.app.ActivityThread.performDestroyActivity (ActivityThread.java:5117) at android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:5162) at android.app.ActivityThread.-wrap9 (ActivityThread.java) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1880) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java:148) at android.app.ActivityThread.main (ActivityThread.java:7325) at java.lang.reflect.Method.invoke! (Native method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

can I ask what android app is keeps crashing ? URL to the app ?

https://play.google.com/store/apps/details?id=org.davebollinger.dropstack

davebollinger, thank you for the URL… I played for a while the game, it works for me… maybe you know how to reproduce the bug/crash ?

Nope, unfortunately that’s heart of the problem - if I knew how to reproduce and/or what was causing it, and thought there was something/anything that *I* could do about it, then I’d have tried it.  I’ve ran it many hundreds of times on devices that have reported the problem but haven’t yet been able to duplicate it myself.

Plus, it’s only a ~1% problem, and seemingly only on certain devices, so it takes a lot of user sessions to reveal the problem via android vitals reporting.  But it happens enough to impact ranking, despite my inability to reproduce.

Based on all the “destroy/dispose” -type stuff that’s going on, and particularly destroylng the openal context, my “feeling” is that it is only happening at app close, though there’s very little that I’m doing at app close that I can even alter in my own code, and most of the crash report seems to stem from deeply internal Corona shutdown stuff.  (granted that I have no ability to trace the internal calls, so my guesses are just based on the phrases present in the stack trace)

I run around 0.5% ANR/crash rate but when that is thousands of sessions per day it is, as @dave points out, a bad ranking signal for sure.

This problem is not something, I believe, we are doing as developers.  If it was I would suspect the percentages would be considerably higher.

Vlad has confirmed a lot of the error logs are occurring when our apps close… surely core could simply suppress errors raised when an app is closing as a simple fix.

@vitaly1, @davebollinger: I have several apps that reproduce the ANR that Dave reported.

Here’s one: https://play.google.com/store/apps/details?id=se.appfamily.puzzle.super2.free

Steps to reproduce:

  1. Start app

  2. Exit by pressing back button twice (on my Pixel C tablet, Android 8.0.0 I need to swipe up from bottom to reveal status bar since app runs in Immersive mode)

Repeat the steps above, and after 2 - 8 repetitions the app will start to a black screen. What has actually happened is that the previous instance has not shut down properly, so the app has re-opened to a state where there is no UI. Tap the screen and the back button about 50 times and eventually the OS will dump the trace file.

Trace file: https://www.dropbox.com/s/eg7ag0wowurc6ss/ANR_traces.txt?dl=0

Some pointers for the file (start, exit, restart): https://www.dropbox.com/s/qg7twipk508z0ds/ANR_notes.txt?dl=0

Logcat output: https://www.dropbox.com/s/4yxddl0mn33t4ts/ANR_logcat.txt?dl=0

I’ve tried these steps in a bunch of my apps.

For me, the ANR happens in apps that initialize Kidoz and cache ads. I have tried the following configurations:

  • Rewarded

  • Panel and rewarded and intersitial

  • Panel and interstitial 

The ANR happens in both previous and current Kidoz versions.

The ANR does NOT happen in apps where Kidoz plugin is configured but un-used (i.e., if you pay to remove all ads). It also does NOT happen in apps which do not use Kidoz.

Important: I don’t think this is to do with Kidoz specifically, but I’m exhausted from chasing this issue so have not tried builds with just Admob. For example, I believe that Dave does NOT use Kidoz, yet sees this ANR. Perhaps something to do with plugins storing ad data on exit, who knows.

Thanks Per!  I’ll try reproducing via back button spam.

I’ll also confirm that I’m NOT using Kidoz, but am using Admob.  I can also confirm that it’s not isolated to a single app, but the session counts and thus quantity of crash reports vary considerably, so not all apps demonstrate the fault so “obviously”.  but fe, here’s another one with enough daily volume to easily notice:  link (also built with 2017.3179, but I won’t reproduce the trace here again, as it’s essentially the same one previously provided for the other app)

Based on Per’s comment, I also checked a paid-only no-ads app, and true enough it has had ZERO crashes OR anr’s over the last 60 days (longest reporting period available via gplay vitals) across ALL versions (including those that were released before the recent attempt to fix openal/almixer).  However, that’s perhaps only of anecdotal value, because unfortunately that paid app doesn’t have anywhere near the same daily volume.  (still, “zero” is a pretty good rate! :D)

[edit: forum editor keeps deleting the url]

Please note I’m not “spamming” the back button. I simply start the app, and exit via back button with double-press (I have a key listener requiring two quick presses to exit, in order to avoid accidental exit).

I’ve experimented with os.exit() now, in the system exit event handler. Seems to trigger a crash rather than an ANR. Feels like it happens less often than the ANR. Don’t know if those backtraces will have anything useful, but I found it interesting to see the following after Corona reports the applicationExit:

a) chromium. I guess a webview for the ads?

B) Two network requests left hanging.

I’m a bit tired so these things might be completely unrelated and simply caused by the unclean exit. But perhaps something related to the ad plugin is not cleaned up in certain situations.

12-11 21:21:42.094  1610  1610 I Corona  : /DUMP: [System] applicationExit  (@D:\Dropbox\Code\workspace-Corona\DevProjects\Pop Balloons Rewarded unlock\main.lua:func:280)

12-11 21:21:42.104  1610  2049 E chromium : [ERROR:gl_fence_egl.cc(34)] Failed to get EGLSync attribute. error code:12300

12-11 21:21:42.104  1610  1610 D NvOsDebugPrintf: NvEglHandle: Unfreed handle upon egl deinit: type=1 refcnt=1

12-11 21:21:42.115  1610  1610 D NvOsDebugPrintf: NvEglHandle: Unfreed handle upon egl deinit: type=1 refcnt=1

12-11 21:21:42.137  1610  1610 D NvOsDebugPrintf: NvEglHandle: Unfreed handle upon egl deinit: type=2 refcnt=2

12-11 21:21:42.264   948  1198 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [LISTEN id=56, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ], android.os.BinderProxy@477a37c)

12-11 21:21:42.265   948  4258 I ActivityManager: Process se.appfamily.balloonpopfree (pid 1610) has died: cch  CEM

12-11 21:21:42.265   948  1029 E ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [LISTEN id=56, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ]

12-11 21:21:42.265   948  1545 I WindowManager: WIN DEATH: Window{13c268d u0 se.appfamily.balloonpopfree/com.ansca.corona.CoronaActivity}

12-11 21:21:42.266   948  1401 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [LISTEN id=55, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ], android.os.BinderProxy@8a89405)

12-11 21:21:42.266  1827  1827 I cr_ChildProcessService: Destroying ChildProcessService pid=1827

12-11 21:21:42.267   948  1029 E ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [LISTEN id=55, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ]

12-11 21:21:42.269   948  4258 I ActivityManager: Killing 1827:com.android.chrome:sandboxed_process0/u0a672i12 (adj 0): isolated not needed

12-11 21:21:42.270   948   969 W ActivityManager: setHasOverlayUi called on unknown pid: 1610

12-11 21:21:42.296   948   964 W zygote64: failed to open /acct/uid_99012/pid_1827/cgroup.procs: No such file or directory

12-11 21:21:46.721   948   961 E memtrack: Couldn’t load memtrack module

12-11 21:21:46.721   948   961 W android.os.Debug: failed to get memory consumption info: -1