Bug 425469

Summary: kmix 20.08.0 crashes on exit
Product: [Applications] kmix Reporter: Jim Jones <rauchwolke>
Component: generalAssignee: Christian Esken <esken>
Status: RESOLVED FIXED    
Severity: normal CC: arojas, gertlink_nospam, jjm, Kwanza.Pili, martin.sandsmark, mister.freeman, rauchwolke
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jim Jones 2020-08-17 18:44:59 UTC
SUMMARY


STEPS TO REPRODUCE
1. start kmix
2. kquitapp5 kmix

OBSERVED RESULT
segmentation fault

EXPECTED RESULT
quits normally

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.19.4
KDE Frameworks Version: 5.73
Qt Version: 5.15.0

ADDITIONAL INFORMATION

it seems the app crashes at

MixerToolBox::deinitMixer();

in

KMixWindow::~KMixWindow()
Comment 1 Jim Jones 2020-08-18 13:57:03 UTC
git bisect points to 8bcf9255d00a28b6abad13023fa2703c78db371a - but it needs 4b0c2e60c70d8ebae87321e4f9ddd8b3876ace03 to get kmix compiled
Comment 2 Jim Jones 2020-08-18 14:20:54 UTC
reverting this code fixes the crash

-                                        char devnum[64];
-                                        snprintf(devnum, sizeof(devnum), "%lu", (unsigned long) dev.index);
-                                        ca_context_change_device(s_ccontext, devnum);
+                                        const QByteArray devnum = QByteArray::number(dev.index);
+                                        ca_context_change_device(s_ccontext, devnum.constData());
Comment 3 Jim Jones 2020-08-18 14:30:38 UTC
(In reply to Jim Jones from comment #2)
> reverting this code fixes the crash
> 
> -                                        char devnum[64];
> -                                        snprintf(devnum, sizeof(devnum),
> "%lu", (unsigned long) dev.index);
> -                                       
> ca_context_change_device(s_ccontext, devnum);
> +                                        const QByteArray devnum =
> QByteArray::number(dev.index);
> +                                       
> ca_context_change_device(s_ccontext, devnum.constData());

this isn't responsible for the crash
Comment 4 Jim Jones 2020-08-18 14:34:52 UTC
seems e20ad13fa703aaba34e23502a912c0c127b0d3d1 is responsible as reverting 8bcf9255d00a28b6abad13023fa2703c78db371a doesn't fix the crash. e20ad13fa703aaba34e23502a912c0c127b0d3d1 + 4b0c2e60c70d8ebae87321e4f9ddd8b3876ace03 to be correct
Comment 5 Jim Jones 2020-08-18 14:41:49 UTC
verified, reverting e20ad13fa703aaba34e23502a912c0c127b0d3d1 + 4b0c2e60c70d8ebae87321e4f9ddd8b3876ace03 fixes the crash
Comment 6 Jonathan Marten 2020-08-18 14:48:49 UTC
@Jim Jones: many thanks for investigating with bisection, do you have a backtrace?
Comment 7 Jim Jones 2020-08-18 23:41:19 UTC
no, gdb doesn't show anything meaningful. I guess it's because of the self implemented QtPaMainLoop which seems to miss something/does something wrong
Comment 8 Jonathan Marten 2020-08-21 11:08:33 UTC
Can reproduce (with PulseAudio):

Thread 1 "kmix" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) where
#0  0x0000000000000000 in ?? ()
#1  0x00007fffee4d2ee9 in pa_srbchannel_free () from /usr/lib64/pulseaudio/libpulsecommon-13.0.so
#2  0x00007fffee4cfb12 in ?? () from /usr/lib64/pulseaudio/libpulsecommon-13.0.so
#3  0x00007fffee4d1dea in pa_pstream_unlink () from /usr/lib64/pulseaudio/libpulsecommon-13.0.so
#4  0x00007ffff2731f15 in ?? () from /usr/lib64/libpulse.so.0
#5  0x00007ffff2732062 in ?? () from /usr/lib64/libpulse.so.0
#6  0x00007ffff7db291d in Mixer_PULSE::~Mixer_PULSE (this=0x5555557e1830, __in_chrg=<optimized out>)
    at kmix/backends/mixer_pulse.cpp:1073
#7  0x00007ffff7db2939 in Mixer_PULSE::~Mixer_PULSE (this=0x5555557e1830, __in_chrg=<optimized out>)
    at kmix/backends/mixer_pulse.cpp:1056
#8  0x00007ffff7d85c16 in Mixer::~Mixer (this=0x55555585a9d0, __in_chrg=<optimized out>)
    at kmix/core/mixer.cpp:115
#9  0x00007ffff7d85c99 in Mixer::~Mixer (this=0x55555585a9d0, __in_chrg=<optimized out>)
    at kmix/core/mixer.cpp:112
#10 0x00007ffff7d7d31a in MixerToolBox::deinitMixer ()
    at kmix/core/mixertoolbox.cpp:356
#11 0x000055555557b978 in KMixWindow::~KMixWindow (this=this@entry=0x555555680970, 
    __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
    at kmix/apps/kmix.cpp:139
#12 0x000055555557bb59 in KMixWindow::~KMixWindow (this=0x555555680970, __in_chrg=<optimized out>, 
    __vtt_parm=<optimized out>) at kmix/apps/kmix.cpp:124
#13 0x0000555555586a76 in KMixApp::~KMixApp (this=0x7fffffffd3d0, __in_chrg=<optimized out>)
    at kmix/apps/KMixApp.cpp:58
#14 0x000055555557850a in main (argc=<optimized out>, argv=<optimized out>)
    at kmix/apps/main.cpp:87
(gdb)
Comment 9 Jonathan Marten 2020-08-22 18:46:25 UTC
Git commit b3fe63796dfaa0b667c21160a9c10615d6690411 by Jonathan Marten.
Committed on 22/08/2020 at 14:15.
Pushed by marten into branch 'master'.

Mixer: Delay the deletion of the backend

The immediate deletion caused a crash with PulseAudio and
the replacement Qt mainloop.

M  +1    -1    core/mixer.cpp

https://invent.kde.org/multimedia/kmix/commit/b3fe63796dfaa0b667c21160a9c10615d6690411
Comment 10 Jonathan Marten 2020-08-22 18:56:46 UTC
The previous commit fixes the problem for me, although I'm not sure of the root cause.
If you can compile from source or apply the patch, please test and reopen the bug if the segfault still happens.
Comment 11 Antonio Rojas 2020-08-22 21:01:46 UTC
*** Bug 425686 has been marked as a duplicate of this bug. ***
Comment 12 Christoph Feck 2020-08-24 23:13:10 UTC
*** Bug 425756 has been marked as a duplicate of this bug. ***
Comment 13 Antonio Rojas 2020-08-27 20:51:02 UTC
Any reason the fix wasn't pushed to 20.08?
Comment 14 Potomac 2020-10-18 01:38:40 UTC
For your information I still have the bug despite kmix 20.08.2-2 version.

I use archlinux, I have 2 soundcards installed on my system :

- sound card from the motherboard gigabyte GA-P35-DS3L  : Realtek ALC888
- Yamaha Corporation YMF-744B [DS-1S Audio Controller] (rev 02)

Not sure if it's the same bug, here is my original bug report from august 2020 about kmixctrl component :
https://bugs.kde.org/show_bug.cgi?id=425686

at each startup I see this error on dmesg :
kmixctrl[766]: segfault at 0 ip 0000000000000000 sp 00007fff8c7d4418 error 14 in kmixctrl[5617ae3ba000+2000]

despite the segfault kmix is still running fine on background
Comment 15 Potomac 2020-10-20 04:10:09 UTC
Hello,

with the new version kmix 20.08.2-2 it is ok the bug is gone,

thanks
Comment 16 gertlink_nospam 2020-11-10 21:08:09 UTC
with kmix 20.08.3-1 the bug is back again.
Comment 17 Potomac 2020-11-10 22:23:44 UTC
I confirm that the bug is back again with kmix 20.08.3-1