Godot: Godot 2.1.4 crash on some Android devices (_ZN17AudioDriverOpenSL9set_pauseEb)

Created on 1 Apr 2018  路  19Comments  路  Source: godotengine/godot

Hi guys,
I released my game on Android using Godot 2.1.4 and I'm getting a lot of crash from different device about this issue:

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)


pid: 0, tid: 0 >>> it.megasoft78.fallingword <<<

backtrace:
#00 pc 0000000000033f20 /data/app/it.megasoft78.fallingword-1/lib/arm/libgodot_android.so (_ZN17AudioDriverOpenSL9set_pauseEb+24)
#01 pc 000000000003e2dc /data/app/it.megasoft78.fallingword-1/lib/arm/libgodot_android.so (Java_org_godotengine_godot_GodotLib_focusin+64)
#02 pc 000000000062cb7d /data/app/it.megasoft78.fallingword-1/oat/arm/base.odex

Here's the list of some devices:

  • Samsung Galaxy Tab A 10.1 (gtaxllte), 2048MB RAM, Android 7.0
  • Samsung Galaxy S6 (zeroflte), 3072MB RAM, Android 7.0
  • ZTE Blade X Max (stollen), 2048MB RAM, Android 7.1
  • Hisense F23 (HS6737MT), 1024MB RAM, Android 7.0
  • Samsung Galaxy A5(2016) (a5xelte), 2048MB RAM, Android 7.0
  • Samsung Galaxy S7 (herolte), 4096MB RAM, Android 7.0
  • Samsung Galaxy S6 Edge (zerolte), 3072MB RAM, Android 7.0
  • Samsung Galaxy J7 Max (j7maxlte), 4096MB RAM, Android 7.0
  • Samsung Galaxy J5(2016) (j5xnlte), 2048MB RAM, Android 7.1
  • Samsung Galaxy A3(2017) (a3y17lte), 2048MB RAM, Android 7.0

I tried with all the devices I have but I'm not able to reproduce it.

Could you please help me?

bug android porting

All 19 comments

maybe combination of...
connecting/disconnecting of earphone jack and...
go back and front of game?

@volzhs What do you mean for go back and front game?
I did try with connecting/disconnecting the earnphone on my device but it doesn't crash. I also tried to do it when sound was playing but no crash.
I don't think is that anyway because it's happening too often. I don't think there are so many people playing with earphone jack all the time.
Any other ideas?

This seems to be the calling method:

void OS_Android::main_loop_focusin() {

    if (main_loop)
        main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
    audio_driver_android.set_pause(false);
}

https://github.com/godotengine/godot/blob/b3f43496a503096e52d6e3f7522a24b251e7bc98/platform/android/os_android.cpp

It's called onResume by Android:
https://github.com/godotengine/godot/blob/bbd8f2c1b42fbf800ae4703c3c68c4faef114331/platform/android/java/src/org/godotengine/godot/Godot.java

@Override
    protected void onResume() {
// Other code...
        mView.onResume();
        mView.queueEvent(new Runnable() {
            @Override
            public void run() {
                GodotLib.focusin();
            }
        });
// Other code...

I don't have a clue either, but I guessed the condition from the code.

  • normal run > connect earphone > pressing home button to game goes to background > anyway to come game back on foreground
  • normal run > connect earphone > pressing home button to game goes to background > unplug earphone > game foreground
  • normal run with earphone connected > etc....

I tried all the possible combinations. It's not that or at least it doesn't happen on my devices. :(

sad to hear that... I wish we could have a reproducing steps...

Is it possible that the instance of playItf is null or not initialized because it was paused?

(*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PAUSED);

I'm suspicious about that but I can't confirm until reproducing it.

active is supposed to be true if playItf is initialized. Meaning if we are calling SetPlayState, then playItf can't be null. Right now I'm reading this OpenSL documentation and trying to figure out what is happening here.

Hi,
I'm not an expert but at page 560 of that document is saying
/* Pause the music - only do so if it is playing */
Maybe it's that?

image

As I said I'm not an expert on this things.
Are you a Godot developer? Do you think checking if it's playing will solve the problem?
Do I need to check if playItf is null as well?
Could you post the code for that?

@megasoft78 I'm a godot contributor, not a core maintainer. I'm not an expert, but I will compile it, and test it. I will test it on:

  • Nokia 6 Android 8.0
  • Nokia 6 Android 8.1
  • Samsung S4 Android 5.1
  • Samsung S4 Android 4.4

Once done, I will remove the WIP tag on the merge request.

Feel free to perform more tests on your side :100:

EDIT
I don't think we need to check if playItf is null because it is a global reference, so to be deleted we have to stop the main loop, and we would not have an issue on focusin.

Hi @xsellier,
Thank you very much.
Unfortunatelly I'm not able to reproduce it on my devices.
I got this error from Google Play Console.
Anyway when you'll have the changes I'll try to compile Godot with your changes and publish on the market. I'm sure if it doesn't work I'll see it in few days. :)

I've tested it on my phones and it works properly.

  1. pause/unpause while the music was playing
  2. plug/unplug earphone while the music was playing
  3. plug/unplug earphone and pause/unpause it at the same time

Tested it on both Samsung S4 and there is no regression.

_EDIT_
I've just published (internally) a fresh new version of my android game including this fix

@xsellier Could you post the fix so I can update my game and see if it solve the problem?

@megasoft78 Its been merged yesterday on branch 2.1 by @akien-mga

Was this page helpful?
0 / 5 - 0 ratings