Giter Club home page Giter Club logo

Comments (19)

madebr avatar madebr commented on September 13, 2024

Can you please build SDL and your test app with debug symbols and provide a crash stacktrace?

cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build . --target SDL3-shared
gcc -o testapp -g src.c libSDL3.so -I ../include -Wl,-rpath,$PWD

Then run your app in gdb as gdb ./testapp.

Inside gdb, start executing with the command run.

When you get it crashing, print a stacktrace with bt.

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024

I've tried gdb ./testapp -ex=run 20 times and finally

build$ gdb ./testapp -ex=run
GNU gdb (Debian 13.1-3) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./testapp...
Starting program: /home/alexander/Downloads/SDL-main/build/testapp 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff735a6c0 (LWP 30302)]
[New Thread 0x7ffff6b596c0 (LWP 30303)]

Thread 3 "SDLAudioHotplug" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6b596c0 (LWP 30303)]
0x00007ffff749e110 in ?? () from /usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-support.so
(gdb) bt
#0  0x00007ffff749e110 in ?? () from /usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-support.so
#1  0x00007ffff748fd4b in ?? () from /usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-support.so
#2  0x00007ffff754cb4a in ?? () from /lib/x86_64-linux-gnu/libpipewire-0.3.so.0
#3  0x00007ffff7aa8134 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#4  0x00007ffff7b287dc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb) 

from sdl.

slouken avatar slouken commented on September 13, 2024

Can you get backtraces for the other threads?

from sdl.

madebr avatar madebr commented on September 13, 2024

And please also install debug symbols for pipewire and other libraries you see in the traces.

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024

ok

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024

hmm... Looks like libpipewire-0.3-0-dbgsym and libspa-0.2-modules-dbgsym are only available for unstable Debian, or maybe I'm searching wrong

Anyway, here's the output of thread apply all bt:

Thread 3 (Thread 0x7ffff6b596c0 (LWP 39352) "SDLAudioHotplug"):
#0  0x00007ffff749e110 in ?? ()
#1  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7ffff735a6c0 (LWP 39351) "testapp"):
#0  0x00007ffff7b27e26 in epoll_wait (epfd=9, events=0x7ffff73599c0, maxevents=32, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x00007ffff749e110 in ?? ()
#2  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7fb3b80 (LWP 39350) "testapp"):
#0  __GI__dl_debug_state () at ./elf/dl-debug.c:117
#1  0x00007ffff7fd6ae0 in dl_open_worker_begin (a=a@entry=0x7fffffffe340) at ./elf/dl-open.c:621
#2  0x00007ffff7b6dfca in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#3  0x00007ffff7fd61c6 in dl_open_worker (a=a@entry=0x7fffffffe340) at ./elf/dl-open.c:782
#4  0x00007ffff7b6dfca in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#5  0x00007ffff7fd65b8 in _dl_open (file=0x7ffff7f19440 "libpulse.so.0", mode=<optimized out>, caller_dlopen=0x7ffff7e47d38 <SDL_LoadObject_REAL+29>, nsid=<optimized out>, argc=1, argv=0x7fffffffe878, env=0x7fffffffe888) at ./elf/dl-open.c:884
#6  0x00007ffff7aa4438 in dlopen_doit (a=a@entry=0x7fffffffe5b0) at ./dlfcn/dlopen.c:56
#7  0x00007ffff7b6dfca in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffe510, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#8  0x00007ffff7b6e07f in __GI__dl_catch_error (objname=0x7fffffffe568, errstring=0x7fffffffe570, mallocedp=0x7fffffffe567, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:227
#9  0x00007ffff7aa3f27 in _dlerror_run (operate=operate@entry=0x7ffff7aa43e0 <dlopen_doit>, args=args@entry=0x7fffffffe5b0) at ./dlfcn/dlerror.c:138
#10 0x00007ffff7aa44e9 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>) at ./dlfcn/dlopen.c:71
#11 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81
#12 0x00007ffff7e47d38 in SDL_LoadObject_REAL (sofile=0x7ffff7f19440 "libpulse.so.0") at /home/alexander/Downloads/SDL-main/src/loadso/dlopen/SDL_sysloadso.c:47
#13 0x00007ffff7e567e1 in LoadPulseAudioLibrary () at /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:167
#14 0x00007ffff7e58d05 in PULSEAUDIO_Init (impl=0x7ffff7f8ba10 <current_audio+16>) at /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:997
--Type <RET> for more, q to quit, c to continue without paging--c
#15 0x00007ffff7c396c3 in SDL_InitAudio (driver_name=0x0) at /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:966
#16 0x00007ffff7c3175b in SDL_InitSubSystem_REAL (flags=16) at /home/alexander/Downloads/SDL-main/src/SDL.c:355
#17 0x00007ffff7c3196b in SDL_Init_REAL (flags=16) at /home/alexander/Downloads/SDL-main/src/SDL.c:489
#18 0x00007ffff7c5b487 in SDL_Init_DEFAULT (a=16) at /home/alexander/Downloads/SDL-main/src/dynapi/SDL_dynapi_procs.h:579
#19 0x00007ffff7c66265 in SDL_Init (a=16) at /home/alexander/Downloads/SDL-main/src/dynapi/SDL_dynapi_procs.h:579
#20 0x0000555555555171 in main () at x.c:10

from sdl.

slouken avatar slouken commented on September 13, 2024

Yeah, we'll need symbols for pipewire to see what's going on here. From what you've shown it looks like a random crash in pipewire, which could either be a bug in SDL or a bug in pipewire.

It might also help to run with address sanitizer to make sure nobody is touching uninitialized memory.

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024

Ok, I've used debuginfod, that downloaded a lot of stuff including pulseaudio, pipewire, and spa
But seems like nothing has changed. Should I use other command?

thread apply all bt:

Thread 3 (Thread 0x7ffff6b596c0 (LWP 40770) "SDLAudioHotplug"):
#0  0x00007ffff749e110 in ?? ()
#1  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7ffff735a6c0 (LWP 40769) "testapp"):
#0  0x00007ffff7b27e26 in epoll_wait (epfd=9, events=0x7ffff73599c0, maxevents=32, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x00007ffff749e110 in ?? ()
#2  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7fb3b80 (LWP 40768) "testapp"):
#0  0x00007ffff7fccbda in _dl_close_worker (map=map@entry=0x555555563ac0, force=force@entry=false) at ./elf/dl-close.c:729
#1  0x00007ffff7fcd026 in _dl_close (_map=0x555555563ac0) at ./elf/dl-close.c:778
#2  0x00007ffff7b6dfca in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffe4e0, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#3  0x00007ffff7b6e07f in __GI__dl_catch_error (objname=0x7fffffffe538, errstring=0x7fffffffe540, mallocedp=0x7fffffffe537, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:227
#4  0x00007ffff7aa3f27 in _dlerror_run (operate=<optimized out>, args=<optimized out>) at ./dlfcn/dlerror.c:138
#5  0x00007ffff7aa3c86 in __dlclose (handle=<optimized out>) at ./dlfcn/dlclose.c:31
#6  0x00007ffff7525469 in unref_plugin (plugin=0x555555564180) at ../src/pipewire/pipewire.c:171
#7  0x00007ffff75256a9 in unref_plugin (plugin=<optimized out>) at ../src/pipewire/pipewire.c:167
#8  unref_handle (handle=0x555555564210) at ../src/pipewire/pipewire.c:212
#9  0x00007ffff75262c3 in unref_handle (handle=<optimized out>) at ../src/pipewire/pipewire.c:206
#10 pw_deinit () at ../src/pipewire/pipewire.c:702
#11 0x00007ffff7e4fa9d in deinit_pipewire_library () at /home/alexander/Downloads/SDL-main/src/audio/pipewire/SDL_pipewire.c:196
#12 0x00007ffff7e51ff2 in PIPEWIRE_Deinitialize () at /home/alexander/Downloads/SDL-main/src/audio/pipewire/SDL_pipewire.c:1216
#13 0x00007ffff7e52193 in PIPEWIRE_PREFERRED_Init (impl=0x7ffff7f8ba10 <current_audio+16>) at /home/alexander/Downloads/SDL-main/src/audio/pipewire/SDL_pipewire.c:1272
#14 0x00007ffff7c396c3 in SDL_InitAudio (driver_name=0x0) at /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:966
#15 0x00007ffff7c3175b in SDL_InitSubSystem_REAL (flags=16) at /home/alexander/Downloads/SDL-main/src/SDL.c:355
#16 0x00007ffff7c3196b in SDL_Init_REAL (flags=16) at /home/alexander/Downloads/SDL-main/src/SDL.c:489
#17 0x00007ffff7c5b487 in SDL_Init_DEFAULT (a=16) at /home/alexander/Downloads/SDL-main/src/dynapi/SDL_dynapi_procs.h:579
#18 0x00007ffff7c66265 in SDL_Init (a=16) at /home/alexander/Downloads/SDL-main/src/dynapi/SDL_dynapi_procs.h:579
#19 0x0000555555555171 in main () at x.c:10                    

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024

compiled with -fsanitize=address:

==40929==ERROR: AddressSanitizer: global-buffer-overflow on address 0x555555558128 at pc 0x5555555551df bp 0x7fffffffe720 sp 0x7fffffffe718
WRITE of size 4 at 0x555555558128 thread T0
    #0 0x5555555551de in main /home/alexander/Downloads/SDL-main/build/x.c:8
    #1 0x7ffff7246249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #2 0x7ffff7246304 in __libc_start_main_impl ../csu/libc-start.c:360
    #3 0x5555555550e0 in _start (/home/alexander/Downloads/SDL-main/build/testapp+0x10e0)

0x555555558128 is located 4 bytes to the right of global variable 'x' defined in 'x.c:4:5' (0x555555558120) of size 4
SUMMARY: AddressSanitizer: global-buffer-overflow /home/alexander/Downloads/SDL-main/build/x.c:8 in main
Shadow bytes around the buggy address:
  0x0aab2aaa2fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2aaa2fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2aaa2ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2aaa3000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2aaa3010: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
=>0x0aab2aaa3020: 00 00 00 00 04[f9]f9 f9 f9 f9 f9 f9 00 00 00 00
  0x0aab2aaa3030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2aaa3040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2aaa3050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2aaa3060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0aab2aaa3070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==40929==ABORTING
[Inferior 1 (process 40929) exited with code 01]

from sdl.

slouken avatar slouken commented on September 13, 2024

What is the text of x.c?

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024

Oops, sorry. wrong file

Here's the correct one:

#include <../include/SDL3/SDL.h>
#include <stdio.h>

int main()
{
    SDL_Init(SDL_INIT_AUDIO);
    printf("test\n");

    SDL_Quit();
}

and the output:

Thread 3 "SDLAudioHotplug" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff4cb76c0 (LWP 41021)]
0x00007ffff6a44d22 in ?? ()
(gdb) thread apply all bt

Thread 3 (Thread 0x7ffff4cb76c0 (LWP 41021) "SDLAudioHotplug"):
#0  0x00007ffff6a44d22 in ?? ()
#1  0x0000000100000000 in ?? ()
#2  0x000062d000000428 in ?? ()
#3  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7ffff54b86c0 (LWP 41020) "testapp"):
#0  0x00007ffff7327e26 in epoll_wait (epfd=9, events=0x7ffff54b7980, maxevents=32, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x00007ffff6a53110 in ?? ()
#2  0x000000000000002e in ?? ()
#3  0x00007ffff7939170 in [email protected] () from /lib/x86_64-linux-gnu/libasan.so.8
#4  0x00007ffff54b7e30 in ?? ()
#5  0x00007ffff54b7e38 in ?? ()
#6  0x00007ffff4cb8000 in ?? ()
#7  0x00007ffff7fdaebe in _dl_fixup (l=0x7ffff54b7be0, reloc_arg=4115364640) at ./elf/dl-runtime.c:95
#8  0x00007ffff7fdd1aa in _dl_runtime_resolve_xsavec () at ../sysdeps/x86_64/dl-trampoline.h:130
#9  0x00007ffff78d4bba in __sanitizer::GetThreadStackTopAndBottom (at_initialization=<optimized out>, stack_top=0x7ffff54b7de8, stack_bottom=0x7ffff54b7de8) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp:150
#10 0x00007ffff790f663 in ?? () from /lib/x86_64-linux-gnu/libasan.so.8
#11 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7eb5600 (LWP 41019) "testapp"):
#0  __GI__dl_debug_state () at ./elf/dl-debug.c:117
#1  0x00007ffff7fd2538 in _dl_map_object_from_fd (name=name@entry=0x7ffff7719440 "libpulse.so.0", origname=origname@entry=0x0, fd=-1, fbp=fbp@entry=0x7fffffffd3f0, realname=<optimized out>, loader=loader@entry=0x0, l_type=<optimized out>, mode=<optimized out>, stack_endp=<optimized out>, nsid=<optimized out>) at ./elf/dl-load.c:1511
#2  0x00007ffff7fd3075 in _dl_map_object (loader=<optimized out>, loader@entry=0x7ffff7fc3260, name=name@entry=0x7ffff7719440 "libpulse.so.0", type=type@entry=2, trace_mode=trace_mode@entry=0, mode=mode@entry=-1879048190, nsid=<optimized out>) at ./elf/dl-load.c:2272
#3  0x00007ffff7fd6a05 in dl_open_worker_begin (a=a@entry=0x7fffffffdaa0) at ./elf/dl-open.c:534
#4  0x00007ffff736dfca in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#5  0x00007ffff7fd61c6 in dl_open_worker (a=a@entry=0x7fffffffdaa0) at ./elf/dl-open.c:782
#6  0x00007ffff736dfca in __GI__dl_catch_exception (exception=<optimized out>, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#7  0x00007ffff7fd65b8 in _dl_open (file=0x7ffff7719440 "libpulse.so.0", mode=<optimized out>, caller_dlopen=0x7ffff785885e <__interceptor_dlopen(char const*, int)+126>, nsid=<optimized out>, argc=1, argv=0x7fffffffe848, env=0x7fffffffe858) at ./elf/dl-open.c:884
#8  0x00007ffff72a4438 in dlopen_doit (a=a@entry=0x7fffffffdd10) at ./dlfcn/dlopen.c:56
#9  0x00007ffff736dfca in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffdc70, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:208
#10 0x00007ffff736e07f in __GI__dl_catch_error (objname=0x7fffffffdcc8, errstring=0x7fffffffdcd0, mallocedp=0x7fffffffdcc7, operate=<optimized out>, args=<optimized out>) at ./elf/dl-error-skeleton.c:227
#11 0x00007ffff72a3f27 in _dlerror_run (operate=operate@entry=0x7ffff72a43e0 <dlopen_doit>, args=args@entry=0x7fffffffdd10) at ./dlfcn/dlerror.c:138
#12 0x00007ffff72a44e9 in dlopen_implementation (dl_caller=<optimized out>, mode=<optimized out>, file=<optimized out>) at ./dlfcn/dlopen.c:71
#13 ___dlopen (file=<optimized out>, mode=<optimized out>) at ./dlfcn/dlopen.c:81
#14 0x00007ffff785885e in __interceptor_dlopen (filename=0x7ffff7719440 "libpulse.so.0", flag=2) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:6384
#15 0x00007ffff7647d38 in SDL_LoadObject_REAL (sofile=0x7ffff7719440 "libpulse.so.0") at /home/alexander/Downloads/SDL-main/src/loadso/dlopen/SDL_sysloadso.c:47
#16 0x00007ffff76567e1 in LoadPulseAudioLibrary () at /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:167
#17 0x00007ffff7658d05 in PULSEAUDIO_Init (impl=0x7ffff778ba10 <current_audio+16>) at /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:997
--Type <RET> for more, q to quit, c to continue without paging--c
#18 0x00007ffff74396c3 in SDL_InitAudio (driver_name=0x0) at /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:966
#19 0x00007ffff743175b in SDL_InitSubSystem_REAL (flags=16) at /home/alexander/Downloads/SDL-main/src/SDL.c:355
#20 0x00007ffff743196b in SDL_Init_REAL (flags=16) at /home/alexander/Downloads/SDL-main/src/SDL.c:489
#21 0x00007ffff745b487 in SDL_Init_DEFAULT (a=16) at /home/alexander/Downloads/SDL-main/src/dynapi/SDL_dynapi_procs.h:579
#22 0x00007ffff7466265 in SDL_Init (a=16) at /home/alexander/Downloads/SDL-main/src/dynapi/SDL_dynapi_procs.h:579
#23 0x00005555555551a7 in main () at x.c:6

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024
build$ ./testapp 
test
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
=================================================================
==41151==ERROR: AddressSanitizer: SEGV on unknown address 0x7fefd7779110 (pc 0x7fefd7779110 bp 0x7fefd61b7b20 sp 0x7fefd61b7980 T1)
==41151==The signal is caused by a READ memory access.
==41151==Hint: PC is at a non-executable region. Maybe a wild jump?
    #0 0x7fefd7779110  (/usr/local/lib/libogg.so.0.8.5+0x8110)
    #1 0x7fefd776ad4a  (<unknown module>)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/usr/local/lib/libogg.so.0.8.5+0x8110) 
Thread T1 created by T0 here:

=================================================================
==41151==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x7fefd86b83b7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
    #1 0x7fefd7769053  (<unknown module>)

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7fefd86b78d5 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:85
    #1 0x7fefd83134dd in real_realloc /home/alexander/Downloads/SDL-main/src/stdlib/SDL_malloc.c:5190
    #2 0x7fefd83137d4 in SDL_realloc_REAL /home/alexander/Downloads/SDL-main/src/stdlib/SDL_malloc.c:5324
    #3 0x7fefd8318fb7 in SDL_SetTLS_REAL /home/alexander/Downloads/SDL-main/src/thread/SDL_thread.c:93
    #4 0x7fefd8319552 in SDL_GetErrBuf /home/alexander/Downloads/SDL-main/src/thread/SDL_thread.c:303
    #5 0x7fefd82327a7 in SDL_SetError_REAL /home/alexander/Downloads/SDL-main/src/SDL_error.c:33
    #6 0x7fefd823aceb in SDL_FindPhysicalAudioDeviceByCallback /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:1419
    #7 0x7fefd823ad34 in SDL_FindPhysicalAudioDeviceByHandle /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:1430
    #8 0x7fefd82389e0 in SDL_AddAudioDevice /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:653
    #9 0x7fefd84583f4 in AddPulseAudioDevice /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:779
    #10 0x7fefd8458443 in SinkInfoCallback /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:787
    #11 0x7fefd64c8431  (/lib/x86_64-linux-gnu/libpulse.so.0+0x1c431)

Indirect leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fefd86b78d5 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:85
    #1 0x7fefd83134dd in real_realloc /home/alexander/Downloads/SDL-main/src/stdlib/SDL_malloc.c:5190
    #2 0x7fefd83194f5 in SDL_GetErrBuf /home/alexander/Downloads/SDL-main/src/thread/SDL_thread.c:296
    #3 0x7fefd82327a7 in SDL_SetError_REAL /home/alexander/Downloads/SDL-main/src/SDL_error.c:33
    #4 0x7fefd823aceb in SDL_FindPhysicalAudioDeviceByCallback /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:1419
    #5 0x7fefd823ad34 in SDL_FindPhysicalAudioDeviceByHandle /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:1430
    #6 0x7fefd82389e0 in SDL_AddAudioDevice /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:653
    #7 0x7fefd84583f4 in AddPulseAudioDevice /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:779
    #8 0x7fefd8458443 in SinkInfoCallback /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:787
    #9 0x7fefd64c8431  (/lib/x86_64-linux-gnu/libpulse.so.0+0x1c431)

Indirect leak of 17 byte(s) in 1 object(s) allocated from:
    #0 0x7fefd86b78d5 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:85
    #1 0x7fefd83134dd in real_realloc /home/alexander/Downloads/SDL-main/src/stdlib/SDL_malloc.c:5190
    #2 0x7fefd8232890 in SDL_SetError_REAL /home/alexander/Downloads/SDL-main/src/SDL_error.c:43
    #3 0x7fefd823aceb in SDL_FindPhysicalAudioDeviceByCallback /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:1419
    #4 0x7fefd823ad34 in SDL_FindPhysicalAudioDeviceByHandle /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:1430
    #5 0x7fefd82389e0 in SDL_AddAudioDevice /home/alexander/Downloads/SDL-main/src/audio/SDL_audio.c:653
    #6 0x7fefd84583f4 in AddPulseAudioDevice /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:779
    #7 0x7fefd8458443 in SinkInfoCallback /home/alexander/Downloads/SDL-main/src/audio/pulseaudio/SDL_pulseaudio.c:787
    #8 0x7fefd64c8431  (/lib/x86_64-linux-gnu/libpulse.so.0+0x1c431)

SUMMARY: AddressSanitizer: 225 byte(s) leaked in 4 allocation(s).
build$ 

from sdl.

slouken avatar slouken commented on September 13, 2024

I think I see what's going on here, give me a minute...

from sdl.

slouken avatar slouken commented on September 13, 2024

Does this fix it?

diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c
index c22269c8c..251b324a3 100644
--- a/src/audio/pipewire/SDL_pipewire.c
+++ b/src/audio/pipewire/SDL_pipewire.c
@@ -1269,6 +1269,7 @@ static SDL_bool PIPEWIRE_PREFERRED_Init(SDL_AudioDriverImpl *impl)
     PIPEWIRE_pw_thread_loop_unlock(hotplug_loop);

     if (no_devices || !pipewire_core_version_at_least(1, 0, 0)) {
+        hotplug_loop_destroy();
         PIPEWIRE_Deinitialize();
         return SDL_FALSE;
     }

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024

Awesome! Everything works perfectly now.
Thanks everyone!

from sdl.

slouken avatar slouken commented on September 13, 2024

Thanks for your patience tracking this down!

from sdl.

sezero avatar sezero commented on September 13, 2024

Is this specific to SDL3, or is SDL2 affected in any way?

from sdl.

Tsukulimer avatar Tsukulimer commented on September 13, 2024

Tested 2.30.6 tarball. No errors.
SDL_GetCurrentAudioDriver() prints "pulseaudio"

from sdl.

slouken avatar slouken commented on September 13, 2024

Is this specific to SDL3, or is SDL2 affected in any way?

This is specific to SDL3.

from sdl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.