Android Question [SOLVED] Sporadic crash mentioning EGL_BAD_ALLOC

Sandman

Expert
Licensed User
Longtime User
I'm using a service when the app is in the background (not Starter), that checks the GPS every couple of minutes or so. Once in a while this service crashes, and I get a message TheApp has stopped. This happens once or twice per 24 hours, roughly.

The first thing I do when the service wakes up is schedule the next run, and like a clock it restarts next time without problems or crashes. The service basically gets a GPS fix, chats with an external API and updates a notification - that's it.

Below is what the IDE logs when this happens. I should note that I'm running the app in Release mode, and am using the #BridgeLogger to get the logs.

B4X:
Failed to create EGLSurface for window 0x7ba365e010, eglErr = EGL_BAD_ALLOC
--------- beginning of crash
Fatal signal 6 (SIGABRT), code -6 in tid 2106 (RenderThread), pid 2090 (the.app.name)

Neither the forum nor Google has a lot to say about this. There is a single hit in the forum for EGL_BAD_ALLOC, but that doesn't seem to relate to this issue. On the net, most hits about that error is related to React, and running the app in an emulator. I'm neither using React (duh), nor using an emulator. So I'm a bit lost here.

Does this error ring a bell for anyone?
 

Sandman

Expert
Licensed User
Longtime User
You know, I actually saw that mentioned in one of the Google hits, so I went looking. I copied all code that is being run in the service and pasted it into a separate document and went through it with a microscope. I couldn't find anything at all. This sums up the service pretty well:

- GPS
- SQLite
- External API
- Notification
- Toast (for debugging)
- Timer

Not a single thing related to activities, views, dialogs or anything else that is UI-ish...
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
Not only Toastmessages but also Notifications are UI elements, even if not related to Activities, so it could also happen here.

Just to narrow-down the search, I'd comment out where the notifications are updated to see if results change.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
I just realized I had a longer error message in another saved log file, perhaps that contains more clues? I'm seeing that backtrace line #05 mentions Bridge_initialize. Does anyone know if that is related to the B4A bridge or just some other bridgething in Android? Surely the problem couldn't be related to the B4A Bridge? (I am running the app in Release mode and use #BridgeLogger.)

B4X:
--------- beginning of crash
Fatal signal 6 (SIGABRT), code -6 in tid 2106 (RenderThread), pid 2090 (the.app.name)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/bullhead/bullhead:8.1.0/OPM6.171019.030.E1/4805388:user/release-keys'
Revision: 'rev_1.0'
ABI: 'arm64'
pid: 2090, tid: 2106, name: RenderThread  >>> the.app.name <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'Failed to create EGLSurface for window 0x7ba365e010, eglErr = EGL_BAD_ALLOC'
    x0   0000000000000000  x1   000000000000083a  x2   0000000000000006  x3   0000000000000008
    x4   0000000000000000  x5   0000000000000000  x6   0000000000000000  x7   7f7f7f7f7f7f7f7f
    x8   0000000000000083  x9   0000000010000000  x10  0000007ba57cec80  x11  0000000000000001
    x12  0000007ba57ceda0  x13  ffffffffffffffff  x14  ff00000000000000  x15  ffffffffffffffff
    x16  00000055641cffa8  x17  0000007c3c02c4b8  x18  0000000000000210  x19  000000000000082a
    x20  000000000000083a  x21  0000000000000083  x22  0000007ba57cf588  x23  0000007c3e9d50dc
    x24  0000007c3e9d5050  x25  0000007ba57cf308  x26  0000007ba57cf310  x27  0000007ba57cf350
    x28  0000007ba57cf300  x29  0000007ba57cecc0  x30  0000007c3bfe16ec
    sp   0000007ba57cec80  pc   0000007c3bfe1714  pstate 0000000060000000
backtrace:
    #00 pc 000000000001d714  /system/lib64/libc.so (abort+120)
    #01 pc 0000000000007f08  /system/lib64/liblog.so (__android_log_assert+296)
    #02 pc 000000000006c300  /system/lib64/libhwui.so (android::uirenderer::renderthread::EglManager::createSurface(ANativeWindow*, bool)+316)
    #03 pc 000000000006a078  /system/lib64/libhwui.so (android::uirenderer::renderthread::OpenGLPipeline::setSurface(android::Surface*, android::uirenderer::renderthread::SwapBehavior, android::uirenderer::renderthread::ColorMode)+76)
    #04 pc 0000000000066df8  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::setSurface(android::Surface*)+144)
    #05 pc 000000000006f5f8  /system/lib64/libhwui.so (android::uirenderer::renderthread::Bridge_initialize(android::uirenderer::renderthread::initializeArgs*)+16)
    #06 pc 00000000000718fc  /system/lib64/libhwui.so (android::uirenderer::renderthread::MethodInvokeRenderTask::run()+24)
    #07 pc 0000000000072a58  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+336)
    #08 pc 0000000000011478  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
    #09 pc 00000000000a9814  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+140)
    #10 pc 0000000000067d0c  /system/lib64/libc.so (__pthread_start(void*)+36)
    #11 pc 000000000001eba4  /system/lib64/libc.so (__start_thread+68)
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Surely the problem couldn't be related to the B4A Bridge?

I'll just go ahead and answer that one myself. No, not related to B4A Bridge. I tried searching for android::uirenderer::renderthread::Bridge_initialize and found this bug, which seems to be an exact match for me:

Real-time crashes, in abort, only in Android 8.1

https://issuetracker.google.com/issues/70259031

Apparently it's a bug related to Android 8.1, which is exactly what I'm using. So I suppose I'll just ignore this bug for now, and let Google sort it out to next OS update.
 
Upvote 0
Top