Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL startup segfault #5809

Closed
M374LX opened this issue Nov 28, 2020 · 4 comments
Closed

SDL startup segfault #5809

M374LX opened this issue Nov 28, 2020 · 4 comments

Comments

@M374LX
Copy link
Contributor

M374LX commented Nov 28, 2020

Sometimes, LMMS (master branch) segfaults at startup.

Update: after building SDL from source, the backtrace gave more useful information.

SDLAudioC3 suggests it is related to SDL. The "C" means it is a capture thread: https://github.com/SDL-mirror/SDL/blob/81117f4052b8ae50a1e49fe5c221e05433ac77ac/src/audio/SDL_audio.c#L1449

Thread 17 "SDLAudioC3" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffbd69d700 (LWP 26426)]
0x0000000000000000 in ?? ()
(gdb) bt full
#0  0x0000000000000000 in ?? ()
No symbol table info available.
#1  0x00007ffff7741cfa in SDL_DBus_Init () at /home/ax/src/SDL2-2.0.12/src/core/linux/SDL_dbus.c:129
        err = {name = 0x0, message = 0x0, dummy1 = 1, dummy2 = 0, dummy3 = 0, dummy4 = 0, dummy5 = 1, padding1 = 0xa8087600}
        is_dbus_available = SDL_FALSE
#2  0x00007ffff77422e1 in SDL_DBus_Init () at /home/ax/src/SDL2-2.0.12/src/core/linux/SDL_dbus.c:168
        is_dbus_available = SDL_FALSE
        err = {name = <optimized out>, message = <optimized out>, dummy1 = <optimized out>, dummy2 = <optimized out>, dummy3 = <optimized out>, dummy4 = <optimized out>, dummy5 = <optimized out>, padding1 = <optimized out>}
#3  SDL_DBus_GetContext () at /home/ax/src/SDL2-2.0.12/src/core/linux/SDL_dbus.c:170
No locals.
#4  0x00007ffff774c069 in rtkit_setpriority (nice_level=-10, thread=26426) at /home/ax/src/SDL2-2.0.12/src/core/linux/SDL_threadprio.c:62
        ui64 = 26426
        si32 = -10
        dbus = <optimized out>
#5  SDL_LinuxSetThreadPriority_REAL (threadID=<optimized out>, priority=-10) at /home/ax/src/SDL2-2.0.12/src/core/linux/SDL_threadprio.c:105
No locals.
#6  0x00007ffff7742e9b in SDL_SYS_SetThreadPriority (priority=priority@entry=SDL_THREAD_PRIORITY_HIGH) at /home/ax/src/SDL2-2.0.12/src/thread/pthread/SDL_systhread.c:207
        value = <optimized out>
        thread = <optimized out>
#7  0x00007ffff76b0235 in SDL_SetThreadPriority_REAL (priority=priority@entry=SDL_THREAD_PRIORITY_HIGH) at /home/ax/src/SDL2-2.0.12/src/thread/SDL_thread.c:470
No locals.
#8  0x00007ffff763d0c3 in SDL_CaptureAudio (devicep=devicep@entry=0x555555f35310) at /home/ax/src/SDL2-2.0.12/src/audio/SDL_audio.c:805
        device = 0x555555f35310
        silence = 0
        delay = 11
        data_len = 4096
        data = <optimized out>
        udata = 0x555555cd33b0
        callback = 0x5555557d4bee <AudioSdl::sdlInputAudioCallback(void*, unsigned char*, int)>
#9  0x00007ffff76afebc in SDL_RunThread (data=0x555555f429f0) at /home/ax/src/SDL2-2.0.12/src/thread/SDL_thread.c:289
        args = 0x555555f429f0
        userfunc = 0x7ffff763d070 <SDL_CaptureAudio>
        userdata = 0x555555f35310
        thread = 0x555555f42690
        statusloc = 0x555555f426a0
#10 0x00007ffff7742cb9 in RunThread (data=<optimized out>) at /home/ax/src/SDL2-2.0.12/src/thread/pthread/SDL_systhread.c:79
No locals.
#11 0x00007ffff7fa1f27 in start_thread (arg=<optimized out>) at pthread_create.c:479
        ret = <optimized out>
        pd = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140736371218176, -968516196008548055, 140737488346942, 140737488346943, 140736371216192, 140736371218176, 968372279680608553, 968498574795516201}, mask_was_saved = 0}}, priv = {pad = {
              0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 0
#12 0x00007ffff5fcbe0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.
@M374LX M374LX added the bug label Nov 28, 2020
@PhysSong
Copy link
Member

I guess there might be some race condition in LoadDBUSLibrary() in SDL2's src/core/linux/SDL_dbus.c, between the audio playing thread and the audio capturing thread.
Can you try downgrading SDL2 to 2.0.10 and check the crash still happens?

@M374LX
Copy link
Contributor Author

M374LX commented Nov 29, 2020

The problem seems to stop when using the latest development version of SDL.

It looks like the bug is in SDL, rather than LMMS.

@M374LX
Copy link
Contributor Author

M374LX commented Nov 30, 2020

Adding a delay before opening the audio input device seems to solve the problem.

@PhysSong
Copy link
Member

Closed in #5815.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants