UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStar™
https://usdx.eu
GNU General Public License v2.0
868 stars 162 forks source link

Crash with upcomming PulseAudio of Portaudio #574

Open daschuer opened 3 years ago

daschuer commented 3 years ago

I am currently testing a new PortAudio version that features a PulseAudio API. https://github.com/PortAudio/portaudio/pull/336

For testing I use Ubuntu Bionic + 2017.8.0-1 (bionic) http://ppa.launchpad.net/tomtomtom/ultrastar-deluxe/ubuntu

Unfortunately the UltraStar is crashing just after startup. Does anyone have an idea why this happens. Is it possible to provide a portaudio update that is not crashing the build?

Here is the log of my test:

daniel@540U4C:~/workspace/portaudio/build$ gdb ultrastardx 
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 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:
<http://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 ultrastardx...(no debugging symbols found)...fertig.
(gdb) b Pa_Initialize
Haltepunkt 1 at 0xee090
(gdb) run
Starting program: /usr/games/ultrastardx 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7dde2fb in _dl_lookup_symbol_x (
    undef_name=0x5555558ac628 "cvCreateImage", undef_map=0x55c02880, 
    ref=0x7fffffffd728, symbol_scope=0x55c02c08, version=0x0, type_class=0, 
    flags=2, skip_map=0x0) at dl-lookup.c:805
805 dl-lookup.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0  0x00007ffff7dde2fb in _dl_lookup_symbol_x (undef_name=0x5555558ac628 "cvCreateImage", undef_map=0x55c02880, ref=0x7fffffffd728, symbol_scope=0x55c02c08, version=0x0, type_class=0, flags=2, skip_map=0x0) at dl-lookup.c:805
#1  0x00007ffff3ac7cb6 in do_sym (flags=2, vers=0x0, who=0x55555580c426, name=0x5555558ac628 "cvCreateImage", handle=0x55c02880) at dl-sym.c:151
#2  0x00007ffff3ac7cb6 in _dl_sym (handle=0x55c02880, name=0x5555558ac628 "cvCreateImage", who=0x55555580c426) at dl-sym.c:254
#3  0x00007ffff71460e4 in dlsym_doit (a=a@entry=0x7fffffffd970) at dlsym.c:50
#4  0x00007ffff3ac81ef in __GI__dl_catch_exception (exception=exception@entry=0x7fffffffd900, operate=0x7ffff71460d0 <dlsym_doit>, args=0x7fffffffd970)
    at dl-error-skeleton.c:196
#5  0x00007ffff3ac827f in __GI__dl_catch_error (objname=0x555555bb6370, errstring=0x555555bb6378, mallocedp=0x555555bb6368, operate=<optimized out>, args=<optimized out>) at dl-error-skeleton.c:215
#6  0x00007ffff7146745 in _dlerror_run (operate=operate@entry=0x7ffff71460d0 <dlsym_doit>, args=args@entry=0x7fffffffd970) at dlerror.c:162
#7  0x00007ffff7146166 in __dlsym (handle=<optimized out>, name=0x5555558ac628 "cvCreateImage") at dlsym.c:70
#8  0x000055555580c426 in  ()
#9  0x0000000000000000 in  ()
(gdb) 
s09bQ5 commented 3 years ago

I think the error is that the code for OpenCV < version 3 compares the result of LoadLibrary with 32. I don't know where that number came from. I guess you don't have libopencv_core.so. Maybe the result of LoadLibrary is cast to an unsigned value? It's strange though that you are the first to report this error. Nowadays I do all my builds with --with-opencv-cxx-api, which is needed for recent versions of OpenCV.

daschuer commented 3 years ago

I have /usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2 installed.

I am probably the first that reports it, because it happens only with the libportaudio under development.

My concern is mainly if we did something wrong there, which triggers the segfault here. Maybe there is something wrong we can easily fix.

s09bQ5 commented 3 years ago

I have /usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2 installed.

But do you have the libopencv_core.so symlink that USDX tries to open?

I am probably the first that reports it, because it happens only with the libportaudio under development.

So when you configure USDX --without-portaudio there is no crash?

daschuer commented 3 years ago

I have the symlink see

daniel@540U4C:~$ ls -l /usr/lib/x86_64-linux-gnu/libopencv_core.so lrwxrwxrwx 1 root root 21 Sep 20 2018 /usr/lib/x86_64-linux-gnu/libopencv_core.so -> libopencv_core.so.3.2

daschuer commented 3 years ago

Strange, now I can no longer reproduce the issue. It still works, even If I remove the libopencv-core-dev package which brings the symlink.

s09bQ5 commented 3 years ago

What is the exact version of the libc6 package you have installed? If it is 2.27-3ubuntu1.4 then it is crashing when dereferencing the symbol_scope parameter before the for loop is executed for the first time: https://github.com/bminor/glibc/blob/23158b08a0908f381459f273a984c6fd328363cb/elf/dl-lookup.c#L811

daschuer commented 3 years ago

My libc6 version is actually 2.27-3ubuntu1.4

I can reliable reproduce the issue when installing a modified libportaudio. But after restart the issue is gone. I can remember that originally a restart does not help. Maybe this was a second issue which is solved now.

Do we have an explanation why a restart makes a difference? Do we have an issue of using uninitialized memory?