davy7125 / polyphone

A soundfont editor for quickly designing musical instruments.
https://www.polyphone.io
GNU General Public License v3.0
360 stars 49 forks source link

Polyphone crashs when exiting #112

Closed mirabilos closed 2 years ago

mirabilos commented 4 years ago

Have a bt full:

x.txt

Seems to be a double-free or something.

mirabilos commented 4 years ago

This might actually be the same thing as https://github.com/musescore/MuseScore/commit/484cd7e81e378f0fedf26ecd0a4d6cd5b77d3c61 in MuseScore.

tl;dr: just QPixmap() crashes, but static QPixmap pixmap = QPixmap(2, 2); pixmap.fill(Qt::white); and then using pixmap doesn’t crash (1×1 seems to also crash). This might be a bug in Qt (or might not be), but easily worked around in applications

dromer commented 3 years ago

Yup, also noticed the segfault on exit.

dvzrv commented 3 years ago

When polyphone crashes upon exit with

           PID: 1476564 (polyphone)
           UID: 1000 (dave)
           GID: 1000 (dave)
        Signal: 6 (ABRT)
     Timestamp: Mon 2021-07-05 19:13:47 CEST (11min ago)
  Command Line: polyphone
    Executable: /usr/bin/polyphone
 Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/tmux.service
          Unit: user@1000.service
     User Unit: tmux.service
         Slice: user-1000.slice
     Owner UID: 1000 (dave)
       Boot ID: 0a1d5f7556384ec4911dbc23ada5f9ad
    Machine ID: a5640b7a4f7946aa8d2d075962e96526
      Hostname: hmbx
       Storage: /var/lib/systemd/coredump/core.polyphone.1000.0a1d5f7556384ec4911dbc23ada5f9ad.1476564.1625505227000000.zst (present)
     Disk Size: 14.2M
       Message: Process 1476564 (polyphone) of user 1000 dumped core.

                Stack trace of thread 1476564:
                #0  0x000062b43d872d22 raise (libc.so.6 + 0x3cd22)
                #1  0x000062b43d85c862 abort (libc.so.6 + 0x26862)
                #2  0x000062b43d85c747 __assert_fail_base.cold (libc.so.6 + 0x26747)
                #3  0x000062b43d86b616 __assert_fail (libc.so.6 + 0x35616)
                #4  0x000062b43f70fcc2 n/a (libportaudio.so.2 + 0x15cc2)
                #5  0x000062b43f70111c n/a (libportaudio.so.2 + 0x711c)
                #6  0x000062b43f7021d3 Pa_Terminate (libportaudio.so.2 + 0x81d3)
                #7  0x0000013f733c727e n/a (polyphone + 0x11827e)
                #8  0x0000013f733c728a n/a (polyphone + 0x11828a)
                #9  0x0000013f733b6056 n/a (polyphone + 0x107056)
                #10 0x0000013f733b6142 n/a (polyphone + 0x107142)
                #11 0x0000013f73468219 n/a (polyphone + 0x1b9219)
                #12 0x0000013f73368bce n/a (polyphone + 0xb9bce)
                #13 0x0000013f73359b52 n/a (polyphone + 0xaab52)
                #14 0x000062b43d85db25 __libc_start_main (libc.so.6 + 0x27b25)
                #15 0x0000013f7335c39e n/a (polyphone + 0xad39e)

                Stack trace of thread 1476695:
                #0  0x000062b43d92f18d syscall (libc.so.6 + 0xf918d)
                #1  0x000062b43f2b1c15 n/a (libjack.so.0 + 0x31c15)
                #2  0x000062b43f294036 n/a (libjack.so.0 + 0x14036)
                #3  0x000062b43f292ef7 n/a (libjack.so.0 + 0x12ef7)
                #4  0x000062b43f2afe3d n/a (libjack.so.0 + 0x2fe3d)
                #5  0x000062b43dd82259 start_thread (libpthread.so.0 + 0x9259)
                #6  0x000062b43d9345e3 __clone (libc.so.6 + 0xfe5e3)

                Stack trace of thread 1478851:
                #0  0x000062b43dd8e8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
                #1  0x000062b43dd88574 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf574)
                #2  0x000062b43de6e000 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt5Core.so.5 + 0xd4000)
                #3  0x000062b43de6b4a8 n/a (libQt5Core.so.5 + 0xd14a8)
                #4  0x000062b43de67fef n/a (libQt5Core.so.5 + 0xcdfef)
                #5  0x000062b43dd82259 start_thread (libpthread.so.0 + 0x9259)
                #6  0x000062b43d9345e3 __clone (libc.so.6 + 0xfe5e3)

                Stack trace of thread 1478834:
                #0  0x000062b43dd8e8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca)
                #1  0x000062b43dd88574 pthread_cond_timedwait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf574)
                #2  0x000062b43de6e000 _ZN14QWaitCondition4waitEP6QMutex14QDeadlineTimer (libQt5Core.so.5 + 0xd4000)
                #3  0x000062b43de6b4a8 n/a (libQt5Core.so.5 + 0xd14a8)
                #4  0x000062b43de67fef n/a (libQt5Core.so.5 + 0xcdfef)
                #5  0x000062b43dd82259 start_thread (libpthread.so.0 + 0x9259)
                #6  0x000062b43d9345e3 __clone (libc.so.6 + 0xfe5e3)

                Stack trace of thread 1476628:
                #0  0x000062b43dd8b79c read (libpthread.so.0 + 0x1279c)
                #1  0x000062b43f2b107f n/a (libjack.so.0 + 0x3107f)
                #2  0x000062b43f2b5f8d n/a (libjack.so.0 + 0x35f8d)
                #3  0x000062b43f2b5dc2 n/a (libjack.so.0 + 0x35dc2)
                #4  0x000062b43f2afe3d n/a (libjack.so.0 + 0x2fe3d)
                #5  0x000062b43dd82259 start_thread (libpthread.so.0 + 0x9259)
                #6  0x000062b43d9345e3 __clone (libc.so.6 + 0xfe5e3)

                Stack trace of thread 1476609:
                #0  0x000062b43d92f18d syscall (libc.so.6 + 0xf918d)
                #1  0x000062b43de68346 _ZN11QBasicMutex12lockInternalEv (libQt5Core.so.5 + 0xce346)
                #2  0x0000013f7344f5af n/a (polyphone + 0x1a05af)
                #3  0x000062b43e0804ff _ZN7QObject5eventEP6QEvent (libQt5Core.so.5 + 0x2e64ff)
                #4  0x000062b43ecccd62 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent (libQt5Widgets.so.5 + 0x15ad62)
                #5  0x000062b43e0533aa _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent (libQt5Core.so.5 + 0x2b93aa)
                #6  0x000062b43e0564a9 _ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData (libQt5Core.so.5 + 0x2bc4a9)
                #7  0x000062b43e0ac9a4 n/a (libQt5Core.so.5 + 0x3129a4)
                #8  0x000062b43ca0f10c g_main_context_dispatch (libglib-2.0.so.0 + 0x5410c)
                #9  0x000062b43ca62b99 n/a (libglib-2.0.so.0 + 0xa7b99)
                #10 0x000062b43ca0c871 g_main_context_iteration (libglib-2.0.so.0 + 0x51871)
                #11 0x000062b43e0abfd6 _ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5 + 0x311fd6)
                #12 0x000062b43e051d1c _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5 + 0x2b7d1c)
                #13 0x000062b43de66e12 _ZN7QThread4execEv (libQt5Core.so.5 + 0xcce12)
                #14 0x000062b43de67fef n/a (libQt5Core

it also takes my libffado based jackd instance with it and I have to power cycle the audio interface to get a functioning jackd again: jackd_polyphone_crash.log

mirabilos commented 3 years ago

David Runge dixit:

           #3  0x000062b43d86b616 __assert_fail (libc.so.6 + 0x35616)
           #4  0x000062b43f70fcc2 n/a (libportaudio.so.2 + 0x15cc2)
           #5  0x000062b43f70111c n/a (libportaudio.so.2 + 0x711c)
           #6  0x000062b43f7021d3 Pa_Terminate (libportaudio.so.2 + 0x81d3)

Which distro is that?

This looks somewhat like http://bugs.debian.org/944509 to me.

bye, //mirabilos -- Gestern Nacht ist mein IRC-Netzwerk explodiert. Ich hatte nicht damit gerechnet, darum bin ich blutverschmiert… wer konnte ahnen, daß SIE so reagier’n… gestern Nacht ist mein IRC-Netzwerk explodiert~~~ (as of 2021-06-15 The MirOS Project temporarily reconvenes on OFTC)

dvzrv commented 3 years ago

I'm packaging for Arch Linux. We're currently on portaudio 19.7.0

mirabilos commented 3 years ago

David Runge dixit:

I'm packaging for Arch Linux. We're currently on portaudio 19.7.0

Mh. Can you check whether the patch from that bugreport is included? We’re at 19.6.0 but it’s unclear which release, if any, has it. It’s been posted on their mailing list but not necessarily made it into a release.

bye, //mirabilos -- Gestern Nacht ist mein IRC-Netzwerk explodiert. Ich hatte nicht damit gerechnet, darum bin ich blutverschmiert… wer konnte ahnen, daß SIE so reagier’n… gestern Nacht ist mein IRC-Netzwerk explodiert~~~ (as of 2021-06-15 The MirOS Project temporarily reconvenes on OFTC) diff --git a/src/hostapi/alsa/pa_linux_alsa.c b/src/hostapi/alsa/pa_linux_alsa.c index 584cde8..643198c 100644 --- a/src/hostapi/alsa/pa_linux_alsa.c +++ b/src/hostapi/alsa/pa_linux_alsa.c @@ -3628,12 +3628,18 @@ error:

/* Fill in pollfd objects. / -static PaError PaAlsaStreamComponent_BeginPolling( PaAlsaStreamComponent self, struct pollfd pfds ) +static PaError PaAlsaStreamComponent_BeginPolling( PaAlsaStreamComponent self, struct pollfd pfds, int *xrunOccurred ) { PaError result = paNoError; int ret = alsa_snd_pcm_poll_descriptors( self->pcm, pfds, self->nfds );

@@ -3794,17 +3800,22 @@ static PaError PaAlsaStream_WaitForFrames( PaAlsaStream self, unsigned long fr if( pollCapture ) { capturePfds = self->pfds;

dvzrv commented 3 years ago

It looks like that particular function has been touched in https://github.com/PortAudio/portaudio/commit/9ddb047ab1028add40e9499d2b1a5f1e78e70e6a#diff-3e7e9f0cc2582a6369526f96cc51af25755aaac51b02202b20f337530d802cba. For me it's hard to tell how that compares to 19.6.0. There are many years of changes between those two versions.

mirabilos commented 3 years ago

David Runge dixit:

It looks like that particular function has been touched in https://github.com/PortAudio/portaudio/commit/9ddb047ab1028add40e9499d2b1a5f1e78e70e6a#diff-3e7e9f0cc2582a6369526f96cc51af25755aaac51b02202b20f337530d802cba.

OK, but that just renamed things. Erk. Lemme try to figure out how to still apply the patch.

bye, //mirabilos -- Gestern Nacht ist mein IRC-Netzwerk explodiert. Ich hatte nicht damit gerechnet, darum bin ich blutverschmiert… wer konnte ahnen, daß SIE so reagier’n… gestern Nacht ist mein IRC-Netzwerk explodiert~~~ (as of 2021-06-15 The MirOS Project temporarily reconvenes on OFTC)

mirabilos commented 3 years ago

Dixi quod…

Lemme try to figure out how to still apply the patch.

This is apparently not necessary, they did the xrun checking though in a different way.

Your best bet is to try and track this down with gdb, building all involved libraries and Polyphone with -Og -ggdb…

Sorry, //mirabilos --

you introduced a merge commit │ % g rebase -i HEAD^^ sorry, no idea and rebasing just fscked │ Segmentation should have cloned into a clean repo │ fault (core dumped) if I rebase that now, it's really ugh │ wuahhhhhh
junaayd123 commented 2 years ago

This is normal. The first time you use poly phone and exit it, it says it crashes. After that you shouldn’t get any more errors