Android: Random crashes SDL_memset

Hi,

has anyone ever seen a segfault like this? Does not happen always.

I/DEBUG ( 120): pid: 29168, tid: 29187, name: Thread-1214 >>>
org.myapp <<<
I/DEBUG ( 120): #01 pc 00103148
/data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+36)
I/DEBUG ( 120): #02 pc 000119c8
/data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+972)
I/DEBUG ( 120): #03 pc 000ae978
/data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+24)
I/DEBUG ( 120): #04 pc 000af414
/data/app-lib/org.myapp-1/libSDL2.so
(Java_org_libsdl_app_SDLActivity_nativeRunAudioThread+24)
I/DEBUG ( 120): 6a7b9bbc 6966e7e0
/data/app-lib/org.myapp-1/libSDL2.so (SDL_SYS_SetThreadPriority+252)
I/DEBUG ( 120): 6a7b9bdc 6966c14c
/data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+40)
I/DEBUG ( 120): 6a7b9bf4 6957a9cc
/data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+976)
I/DEBUG ( 120): 6a7b9c18 5a58a2b4
/data/app-lib/org.myapp-1/libSDL2_mixer.so
I/DEBUG ( 120): 6a7b9c2c 6961797c
/data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+28)

SDL2 and SDL2_mixer are just a few hours old (latest mercurial)

Greetings
Martin

Hi,

has anyone ever seen a segfault like this? Does not happen always.

I/DEBUG ( 120): pid: 29168, tid: 29187, name: Thread-1214 >>> org.myapp <<<
I/DEBUG ( 120): #01 pc 00103148 /data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+36)
I/DEBUG ( 120): #02 pc 000119c8 /data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+972)
I/DEBUG ( 120): #03 pc 000ae978 /data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+24)
I/DEBUG ( 120): #04 pc 000af414 /data/app-lib/org.myapp-1/libSDL2.so (Java_org_libsdl_app_SDLActivity_nativeRunAudioThread+24)
I/DEBUG ( 120): 6a7b9bbc 6966e7e0 /data/app-lib/org.myapp-1/libSDL2.so (SDL_SYS_SetThreadPriority+252)
I/DEBUG ( 120): 6a7b9bdc 6966c14c /data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+40)
I/DEBUG ( 120): 6a7b9bf4 6957a9cc /data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+976)
I/DEBUG ( 120): 6a7b9c18 5a58a2b4 /data/app-lib/org.myapp-1/libSDL2_mixer.so
I/DEBUG ( 120): 6a7b9c2c 6961797c /data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+28)

SDL2 and SDL2_mixer are just a few hours old (latest mercurial)

Do you have memset on Android? If so, SDL_memset just calls memset,
so the bug is either in the call arguments or it’s a corruption.

However looking at the software SDL_memset … oh dear this code is bugged!

void *
SDL_memset(void *dst, int c, size_t len)
{
#if defined(HAVE_MEMSET)
return memset(dst, c, len);
#else
size_t left = (len % 4);
Uint32 *dstp4;
Uint8 *dstp1;
Uint32 value4 = (c | (c << 8) | (c << 16) | (c << 24));
—>

It is a bad idea to do bit operations on signed values, the results are not well defined.

Uint8 value1 = (Uint8) c;

dstp4 = (Uint32 *) dst;
len /= 4;
while (len--) {
    *dstp4++ = value4;

—>

This is a definite bug. Possible alignment issue. Write 4 byte word
to unaligned address.

}

dstp1 = (Uint8 *) dstp4;
switch (left) {
case 3:
    *dstp1++ = value1;
case 2:
    *dstp1++ = value1;
case 1:
    *dstp1++ = value1;
}

return dst;

#endif /* HAVE_MEMSET */
}On 04/08/2013, at 7:20 AM, Martin Gerhardy wrote:


john skaller
@john_skaller
http://felix-lang.org

Just wanted to chime in to say that I also am experiencing this same segfault in SDL_memset() on Android.

2013/8/3 Martin Gerhardy <martin.gerhardy at gmail.com>

Hi,

has anyone ever seen a segfault like this? Does not happen always.

I/DEBUG ( 120): pid: 29168, tid: 29187, name: Thread-1214 >>> org.myapp
<<<
I/DEBUG ( 120): #01 pc 00103148 /data/app-lib/org.myapp-1/**libSDL2.so
(SDL_memset+36)
I/DEBUG ( 120): #02 pc 000119c8 /data/app-lib/org.myapp-1/**libSDL2.so
(SDL_RunAudio+972)
I/DEBUG ( 120): #03 pc 000ae978 /data/app-lib/org.myapp-1/**libSDL2.so
(Android_RunAudioThread+24)
I/DEBUG ( 120): #04 pc 000af414 /data/app-lib/org.myapp-1/**libSDL2.so
(Java_org_libsdl_app_**SDLActivity_*nativeRunAudioThread+24)
I/DEBUG ( 120): 6a7b9bbc 6966e7e0 /data/app-lib/org.myapp-1/

*libSDL2.so (SDL_SYS_SetThreadPriority+*252)
I/DEBUG ( 120): 6a7b9bdc 6966c14c /data/app-lib/org.myapp-1/

libSDL2.so (SDL_memset+40)
I/DEBUG ( 120): 6a7b9bf4 6957a9cc /data/app-lib/org.myapp-1/

libSDL2.so (SDL_RunAudio+976)
I/DEBUG ( 120): 6a7b9c18 5a58a2b4 /data/app-lib/org.myapp-1/

libSDL2_mixer.so
I/DEBUG ( 120): 6a7b9c2c 6961797c /data/app-lib/org.myapp-1/

*libSDL2.so (Android_RunAudioThread+28)

SDL2 and SDL2_mixer are just a few hours old (latest mercurial)

I wasn’t able to reproduce this problem, so a bit more information would be
helpful (more of the adb logcat for starters).
Anything in particular that may trigger this? A revision where this used to
work fine?

I’ve added a “stab in the dark” fix here
http://hg.libsdl.org/SDL/rev/96b76c2ce46a Let me know if you still
experience problems with it.–
Gabriel.

I wasn’t able to reproduce this problem, so a bit more information
would be helpful (more of the adb logcat for starters).
Anything in particular that may trigger this? A revision where this
used to work fine?

I’ve added a “stab in the dark” fix here
http://hg.libsdl.org/SDL/rev/96b76c2ce46a Let me know if you still
experience problems with it.

Hi,

have you seen the response from John Skaller from 4th of August? It
might be an alignment problem here.

But I can’t give more information. I don’t know a revision that worked,
and the backtrace from logcat is all I have about this crash. I’m also
not sure what triggers this. Alignment might explain the randomness of
the crash.

Do you want me to check anything in particular?

Regards
Martin

2013/8/8 Martin Gerhardy <martin.gerhardy at gmail.com>

I wasn’t able to reproduce this problem, so a bit more information would
be helpful (more of the adb logcat for starters).
Anything in particular that may trigger this? A revision where this used
to work fine?

I’ve added a “stab in the dark” fix here http://hg.libsdl.org/SDL/rev/**
96b76c2ce46a http://hg.libsdl.org/SDL/rev/96b76c2ce46a Let me know if
you still experience problems with it.

Hi,

have you seen the response from John Skaller from 4th of August? It might
be an alignment problem here.

But I can’t give more information. I don’t know a revision that worked,
and the backtrace from logcat is all I have about this crash. I’m also not
sure what triggers this. Alignment might explain the randomness of the
crash.

Do you want me to check anything in particular?

The Android platform has memset so the alignment issue isn’t likely to be
the problem.–
Gabriel.

I don’t have any more info than Martin has already posted, but I can attest that it has only occurred for me during the initialization of SDL_mixer in SDL_RunAudio(), exactly as Martin posted. Like Martin, it is seemingly random as to when it occurs, as well.

And what I mean by “random” is that about 80-90% of the time the crash does not occur, and SDL_mixer will start up just fine.

2013/8/8 jlev31415

**
And what I mean by “random” is that about 80-90% of the time the crash
does not occur, and SDL_mixer will start up just fine.

Do you have a certain device, or a test case where this happens more often,
something to help narrow it down?–
Gabriel.

I’m currently developing on a Samsung Galaxy S4. As far a a test case, I could try to narrow my engine down to the calls necessary to reproduce it, but basically I am only calling the following SDL-related functions before the crash occurs:

Code:

SDL_Init( SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE );

IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG);

SDL_CreateWindow(“title”, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL);

Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024);

Do you still get crashes with the fix I uploaded today?

2013/8/8 jlev31415 > **

I’m currently developing on a Samsung Galaxy S4. As far a a test case, I
could try to narrow my engine down to the calls necessary to reproduce it,
but basically I am only calling the following SDL-related functions before
the crash occurs:

Code:

SDL_Init( SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE );

IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG);

SDL_CreateWindow(“title”, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
1280, 720, SDL_WINDOW_OPENGL);

Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024);


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.

I saw your commit but I have not yet updated and built the latest code. It might be a day or two, but I’ll update this thread once I do. Thanks.

I’m not able to reproduce it right now - but that doesn’t mean much, as
it didn’t happen that often. I will report back when the crash happens
again.Am 08.08.2013 20:09, schrieb Gabriel Jacobo:

Do you still get crashes with the fix I uploaded today?

2013/8/8 jlev31415 <joeleveque at gmail.com <mailto:joeleveque at gmail.com>>

I'm currently developing on a Samsung Galaxy S4. As far a a test
case, I could try to narrow my engine down to the calls necessary
to reproduce it, but basically I am only calling the following
SDL-related functions before the crash occurs:




Code: 	


SDL_Init( SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE );

IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG);

SDL_CreateWindow("title", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL);

Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024);

	


_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Of course, right after I sent the mail… here it is again:

I/myapp 0.3( 4677): INFO: available audio driver dummy
I/myapp 0.3( 4677): INFO: available audio driver android
I/myapp 0.3( 4677): INFO: actual audio driver: android
I/DEBUG ( 120): pid: 4677, tid: 4696, name: Thread-3479 >>> org.myapp <<<
I/DEBUG ( 120): #01 pc 00103150
/data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+36)
I/DEBUG ( 120): #02 pc 00011938
/data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+972)
I/DEBUG ( 120): #03 pc 000ae8e8
/data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+24)
I/DEBUG ( 120): #04 pc 000af3dc
/data/app-lib/org.myapp-1/libSDL2.so
(Java_org_libsdl_app_SDLActivity_nativeRunAudioThread+24)
I/DEBUG ( 120): 6a7babbc 6966e7e8
/data/app-lib/org.myapp-1/libSDL2.so (SDL_SYS_SetThreadPriority+252)
I/DEBUG ( 120): 6a7babdc 6966c154
/data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+40)
I/DEBUG ( 120): 6a7babf4 6957a93c
/data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+976)
I/DEBUG ( 120): 6a7bac18 5a58a2b4
/data/app-lib/org.myapp-1/libSDL2_mixer.so
I/DEBUG ( 120): 6a7bac2c 696178ec
/data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+28)
W/ActivityManager( 430): Force finishing activity org.myapp/.myapp
W/InputDispatcher( 430): channel ‘429b1848 org.myapp/org.myapp.myapp
(server)’ ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 430): channel ‘429b1848 org.myapp/org.myapp.myapp
(server)’ ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher( 430): Attempted to unregister already unregistered
input channel '429b1848 org.myapp/org.myapp.myapp (server)'
I/WindowState( 430): WIN DEATH: Window{429b1848 u0
org.myapp/org.myapp.myapp}
I/ActivityManager( 430): Process org.myapp (pid 4677) has died.

and here in more detail:

********** Crash dump: **********
Build fingerprint:
'google/nakasi/grouper:4.3/JWR66V/737497:user/release-keys’
pid: 4677, tid: 4696, name: Thread-3479 >>> org.myapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00 pc 0001d050 /system/lib/libc.so (memset+248)
Stack frame #01 pc 00103150 /data/app-lib/org.myapp-1/libSDL2.so
(SDL_memset+36): Routine SDL_memset in jni/SDL/src/stdlib/SDL_string.c:290
Stack frame #02 pc 00011938 /data/app-lib/org.myapp-1/libSDL2.so
(SDL_RunAudio+972): Routine SDL_RunAudio in
jni/SDL/src/audio/SDL_audio.c:483
Stack frame #03 pc 000ae8e8 /data/app-lib/org.myapp-1/libSDL2.so
(Android_RunAudioThread+24): Routine Android_RunAudioThread in
jni/SDL/src/audio/android/SDL_androidaudio.c:150
Stack frame #04 pc 000af3dc /data/app-lib/org.myapp-1/libSDL2.so
(Java_org_libsdl_app_SDLActivity_nativeRunAudioThread+24): Routine
Java_org_libsdl_app_SDLActivity_nativeRunAudioThread in
jni/SDL/src/core/android/SDL_android.c:254
Stack frame #05 pc 0001dc4c /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #06 pc 0004decf /system/lib/libdvm.so
(dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
Stack frame #07 pc 0004f8bd /system/lib/libdvm.so
(dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*,
Thread*)+184)
Stack frame #08 pc 00027060 /system/lib/libdvm.so
Stack frame #09 pc 0002b5ec /system/lib/libdvm.so
(dvmInterpret(Thread*, Method const*, JValue*)+184)
Stack frame #10 pc 0005ff21 /system/lib/libdvm.so
(dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*,
std::__va_list)+292)
Stack frame #11 pc 0005ff4b /system/lib/libdvm.so
(dvmCallMethod(Thread*, Method const*, Object*, JValue*, …)+20)
Stack frame #12 pc 00054ccb /system/lib/libdvm.so
Stack frame #13 pc 0000ca58 /system/lib/libc.so (__thread_entry+72)
Stack frame #14 pc 0000cbd4 /system/lib/libc.so (pthread_create+208)Am 08.08.2013 20:09, schrieb Gabriel Jacobo:

Do you still get crashes with the fix I uploaded today?

2013/8/8 jlev31415 <joeleveque at gmail.com <mailto:joeleveque at gmail.com>>

I'm currently developing on a Samsung Galaxy S4. As far a a test
case, I could try to narrow my engine down to the calls necessary
to reproduce it, but basically I am only calling the following
SDL-related functions before the crash occurs:




Code: 	


SDL_Init( SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE );

IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG);

SDL_CreateWindow("title", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL);

Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024);

	


_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks, I’ve spotted what I think could be the root of a race condition
which will explain the random behaviour you were experiencing. Let me know
if this changeset fixes things: http://hg.libsdl.org/SDL/rev/627d571587d3

2013/8/8 Martin Gerhardy <martin.gerhardy at gmail.com>> Of course, right after I sent the mail… here it is again:

I/myapp 0.3( 4677): INFO: available audio driver dummy
I/myapp 0.3( 4677): INFO: available audio driver android
I/myapp 0.3( 4677): INFO: actual audio driver: android
I/DEBUG ( 120): pid: 4677, tid: 4696, name: Thread-3479 >>> org.myapp
<<<
I/DEBUG ( 120): #01 pc 00103150
/data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+36)
I/DEBUG ( 120): #02 pc 00011938
/data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+972)
I/DEBUG ( 120): #03 pc 000ae8e8
/data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+24)
I/DEBUG ( 120): #04 pc 000af3dc
/data/app-lib/org.myapp-1/libSDL2.so
(Java_org_libsdl_app_SDLActivity_nativeRunAudioThread+24)
I/DEBUG ( 120): 6a7babbc 6966e7e8
/data/app-lib/org.myapp-1/libSDL2.so (SDL_SYS_SetThreadPriority+252)
I/DEBUG ( 120): 6a7babdc 6966c154
/data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+40)
I/DEBUG ( 120): 6a7babf4 6957a93c
/data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+976)
I/DEBUG ( 120): 6a7bac18 5a58a2b4
/data/app-lib/org.myapp-1/libSDL2_mixer.so
I/DEBUG ( 120): 6a7bac2c 696178ec
/data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+28)
W/ActivityManager( 430): Force finishing activity org.myapp/.myapp
W/InputDispatcher( 430): channel ‘429b1848 org.myapp/org.myapp.myapp
(server)’ ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 430): channel ‘429b1848 org.myapp/org.myapp.myapp
(server)’ ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher( 430): Attempted to unregister already unregistered
input channel '429b1848 org.myapp/org.myapp.myapp (server)'
I/WindowState( 430): WIN DEATH: Window{429b1848 u0
org.myapp/org.myapp.myapp}
I/ActivityManager( 430): Process org.myapp (pid 4677) has died.

and here in more detail:

********** Crash dump: **********
Build fingerprint:
'google/nakasi/grouper:4.3/JWR66V/737497:user/release-keys’
pid: 4677, tid: 4696, name: Thread-3479 >>> org.myapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00 pc 0001d050 /system/lib/libc.so (memset+248)
Stack frame #01 pc 00103150 /data/app-lib/org.myapp-1/libSDL2.so
(SDL_memset+36): Routine SDL_memset in jni/SDL/src/stdlib/SDL_string.c:290
Stack frame #02 pc 00011938 /data/app-lib/org.myapp-1/libSDL2.so
(SDL_RunAudio+972): Routine SDL_RunAudio in
jni/SDL/src/audio/SDL_audio.c:483
Stack frame #03 pc 000ae8e8 /data/app-lib/org.myapp-1/libSDL2.so
(Android_RunAudioThread+24): Routine Android_RunAudioThread in
jni/SDL/src/audio/android/SDL_androidaudio.c:150
Stack frame #04 pc 000af3dc /data/app-lib/org.myapp-1/libSDL2.so
(Java_org_libsdl_app_SDLActivity_nativeRunAudioThread+24): Routine
Java_org_libsdl_app_SDLActivity_nativeRunAudioThread in
jni/SDL/src/core/android/SDL_android.c:254
Stack frame #05 pc 0001dc4c /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #06 pc 0004decf /system/lib/libdvm.so
(dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
Stack frame #07 pc 0004f8bd /system/lib/libdvm.so
(dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*,
Thread*)+184)
Stack frame #08 pc 00027060 /system/lib/libdvm.so
Stack frame #09 pc 0002b5ec /system/lib/libdvm.so (dvmInterpret(Thread*,
Method const*, JValue*)+184)
Stack frame #10 pc 0005ff21 /system/lib/libdvm.so
(dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*,
std::__va_list)+292)
Stack frame #11 pc 0005ff4b /system/lib/libdvm.so
(dvmCallMethod(Thread*, Method const*, Object*, JValue*, …)+20)
Stack frame #12 pc 00054ccb /system/lib/libdvm.so
Stack frame #13 pc 0000ca58 /system/lib/libc.so (__thread_entry+72)
Stack frame #14 pc 0000cbd4 /system/lib/libc.so (pthread_create+208)

Am 08.08.2013 20:09, schrieb Gabriel Jacobo:

Do you still get crashes with the fix I uploaded today?

2013/8/8 jlev31415

I’m currently developing on a Samsung Galaxy S4. As far a a test case,
I could try to narrow my engine down to the calls necessary to reproduce
it, but basically I am only calling the following SDL-related functions
before the crash occurs:

Code:

SDL_Init( SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE );

IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG);

SDL_CreateWindow(“title”, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
1280, 720, SDL_WINDOW_OPENGL);

Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024);


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing listSDL at lists.libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.

I hope I’m not too early again - but I think you fixed it. If I get it
again right after hitting send I will let you know :wink:

Thanks a lot

MartinAm 09.08.2013 02:27, schrieb Gabriel Jacobo:

Thanks, I’ve spotted what I think could be the root of a race
condition which will explain the random behaviour you were
experiencing. Let me know if this changeset fixes things:
http://hg.libsdl.org/SDL/rev/627d571587d3

2013/8/8 Martin Gerhardy <@Martin_Gerhardy
mailto:Martin_Gerhardy>

Of course, right after I sent the mail.... here it is again:

I/myapp 0.3( 4677): INFO: available audio driver dummy
I/myapp 0.3( 4677): INFO: available audio driver android
I/myapp 0.3( 4677): INFO: actual audio driver: android
I/DEBUG   (  120): pid: 4677, tid: 4696, name: Thread-3479  >>>
org.myapp <<<
I/DEBUG   (  120):     #01  pc 00103150
/data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+36)
I/DEBUG   (  120):     #02  pc 00011938
/data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+972)
I/DEBUG   (  120):     #03  pc 000ae8e8
/data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+24)
I/DEBUG   (  120):     #04  pc 000af3dc
/data/app-lib/org.myapp-1/libSDL2.so
(Java_org_libsdl_app_SDLActivity_nativeRunAudioThread+24)
I/DEBUG   (  120):          6a7babbc  6966e7e8
/data/app-lib/org.myapp-1/libSDL2.so (SDL_SYS_SetThreadPriority+252)
I/DEBUG   (  120):          6a7babdc  6966c154
/data/app-lib/org.myapp-1/libSDL2.so (SDL_memset+40)
I/DEBUG   (  120):          6a7babf4  6957a93c
/data/app-lib/org.myapp-1/libSDL2.so (SDL_RunAudio+976)
I/DEBUG   (  120):          6a7bac18  5a58a2b4
/data/app-lib/org.myapp-1/libSDL2_mixer.so
I/DEBUG   (  120):          6a7bac2c  696178ec
/data/app-lib/org.myapp-1/libSDL2.so (Android_RunAudioThread+28)
W/ActivityManager(  430):   Force finishing activity org.myapp/.myapp
W/InputDispatcher(  430): channel '429b1848
org.myapp/org.myapp.myapp (server)' ~ Consumer closed input
channel or an error occurred.  events=0x9
E/InputDispatcher(  430): channel '429b1848
org.myapp/org.myapp.myapp (server)' ~ Channel is unrecoverably
broken and will be disposed!
W/InputDispatcher(  430): Attempted to unregister already
unregistered input channel '429b1848 org.myapp/org.myapp.myapp
(server)'
I/WindowState(  430): WIN DEATH: Window{429b1848 u0
org.myapp/org.myapp.myapp}
I/ActivityManager(  430): Process org.myapp (pid 4677) has died.


and here in more detail:

********** Crash dump: **********
Build fingerprint:
'google/nakasi/grouper:4.3/JWR66V/737497:user/release-keys'
pid: 4677, tid: 4696, name: Thread-3479  >>> org.myapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00  pc 0001d050  /system/lib/libc.so (memset+248)
Stack frame #01  pc 00103150 /data/app-lib/org.myapp-1/libSDL2.so
(SDL_memset+36): Routine SDL_memset in
jni/SDL/src/stdlib/SDL_string.c:290
Stack frame #02  pc 00011938 /data/app-lib/org.myapp-1/libSDL2.so
(SDL_RunAudio+972): Routine SDL_RunAudio in
jni/SDL/src/audio/SDL_audio.c:483
Stack frame #03  pc 000ae8e8 /data/app-lib/org.myapp-1/libSDL2.so
(Android_RunAudioThread+24): Routine Android_RunAudioThread in
jni/SDL/src/audio/android/SDL_androidaudio.c:150
Stack frame #04  pc 000af3dc /data/app-lib/org.myapp-1/libSDL2.so
(Java_org_libsdl_app_SDLActivity_nativeRunAudioThread+24): Routine
Java_org_libsdl_app_SDLActivity_nativeRunAudioThread in
jni/SDL/src/core/android/SDL_android.c:254
Stack frame #05  pc 0001dc4c  /system/lib/libdvm.so
(dvmPlatformInvoke+112)
Stack frame #06  pc 0004decf  /system/lib/libdvm.so
(dvmCallJNIMethod(unsigned int const*, JValue*, Method const*,
Thread*)+398)
Stack frame #07  pc 0004f8bd  /system/lib/libdvm.so
(dvmResolveNativeMethod(unsigned int const*, JValue*, Method
const*, Thread*)+184)
Stack frame #08  pc 00027060  /system/lib/libdvm.so
Stack frame #09  pc 0002b5ec  /system/lib/libdvm.so
(dvmInterpret(Thread*, Method const*, JValue*)+184)
Stack frame #10  pc 0005ff21  /system/lib/libdvm.so
(dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*,
std::__va_list)+292)
Stack frame #11  pc 0005ff4b  /system/lib/libdvm.so
(dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Stack frame #12  pc 00054ccb  /system/lib/libdvm.so
Stack frame #13  pc 0000ca58  /system/lib/libc.so (__thread_entry+72)
Stack frame #14  pc 0000cbd4  /system/lib/libc.so (pthread_create+208)


Am 08.08.2013 20:09, schrieb Gabriel Jacobo:
Do you still get crashes with the fix I uploaded today?


2013/8/8 jlev31415 <joeleveque at gmail.com
<mailto:joeleveque at gmail.com>>

    I'm currently developing on a Samsung Galaxy S4. As far a a
    test case, I could try to narrow my engine down to the calls
    necessary to reproduce it, but basically I am only calling
    the following SDL-related functions before the crash occurs:




    Code: 	


    SDL_Init( SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE );

    IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG);

    SDL_CreateWindow("title", SDL_WINDOWPOS_CENTERED,
    SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL);

    Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 1024);

    	


    _______________________________________________
    SDL mailing list
    SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
    http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




-- 
Gabriel.


_______________________________________________
SDL mailing list
SDL at lists.libsdl.org  <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
SDL at lists.libsdl.org <mailto:SDL at lists.libsdl.org>
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Gabriel,

I can’t say conclusively due to the random nature of the crash, but it appears as though your latest changeset does fix the crash :slight_smile: I have started my app over 20 times now without a single crash, and that was rare before. I will continue testing and report my results. Hopefully Martin can parallel my efforts, too. Thanks!

gabomdq wrote:> Thanks, I’ve spotted what I think could be the root of a race condition which will explain the random behaviour you were experiencing. Let me know if this changeset fixes things:?http://hg.libsdl.org/SDL/rev/627d571587d3 (http://hg.libsdl.org/SDL/rev/627d571587d3)

There’s a further extension of Gabriel’s change here:

Thanks everyone for jumping in on this problem! :)On Fri, Aug 9, 2013 at 3:09 PM, jlev31415 wrote:

**
Gabriel,

I can’t say conclusively due to the random nature of the crash, but it
appears as though your latest changeset does fix the crash [image: Smile]I have started my app over 20 times now without a single crash, and that
was rare before. I will continue testing and report my results. Hopefully
Martin can parallel my efforts, too. Thanks!

gabomdq wrote:

Thanks, I’ve spotted what I think could be the root of a race condition
which will explain the random behaviour you were experiencing. Let me know
if this changeset fixes things: http://hg.libsdl.org/SDL/rev/627d571587d3


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org