Bug 397746

Summary: Notification sounds crash applications when using JACK (Previously "Confirm Paste dialog crashes konsole")
Product: [Unmaintained] phonon-backend-gstreamer Reporter: Lukas Sabota <lukas>
Component: generalAssignee: Daniel Vrátil <dvratil>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: harmathy, kde, lukas, myriam, nate, romain.perier, sitter, tdfischer
Priority: NOR    
Version: 4.9.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: strace output of pasting 160k characters

Description Lukas Sabota 2018-08-22 14:30:54 UTC
When pasting a large amount of text in Konsole, the "Confirm Paste - Konsole" dialog is raised which asks "Are you sure you want to paste <x> characters?".  However, every time this dialog appears, I am unable to click on "Continue" or "Cancel" and the parent Konsole also crashes.

In addition (may be a separate bug?) - when attempting to close the "Confirm Paste" dialog with the close button on the window titelbar, kwin raises a "Warning - Window Manager" dialog to inform that "Application 'konsole' is not responding".  However, I unable to click on "Terminate" or "Wait longer".  Shortly after attempting to click on the unresponsive KWin dialog, another "Warning - Window Manager" dialog is raised, but this time because "Application kwin_killer_helper" is not responding.  If I click on the new dialog, it will not respond and another "kwin_killer_helper" dialog will appear.

I am able to reproduce this Konsole issue reliably with about 20k characters.  I am also able to reproduce this kwin issue on any hanging window - not just Konsole windows.  I'm not sure if this is a Konsole bug, a KMessageBox bug (or some other KDE API), a Kwin bug, or a Konsole and Kwin bug - but I wanted to get a discussion rolling about this issue and see if others are able to reproduce.

Please let me know if there is any additional information to provide - I would be happy to assist troubleshooting this issue.

Cheers
Comment 1 Lukas Sabota 2018-08-22 14:44:04 UTC
Created attachment 114544 [details]
strace output of pasting 160k characters

This is the output of strace when starting a konsole and pasting 160k characters in order to trigger the "Paste Warning" dialog.

Not sure how helpful the output is but maybe someone might see something
Comment 2 Lukas Sabota 2018-08-22 14:53:32 UTC
Okay - I have found another way to reproduce this bug that might shed some light to what is actually going on.

When I try to save a profile with an empty profile name, a KMessageBox is raised ("Sorry - Konsole") that says "Each profile must have a name before it can be saved into disk".  This KMessageBox fails in the exact same way as the "Paste Warning" dialog. Here's steps to reproduce:

1) Open Konsole
2) In the menu:  Settings -> Edit current profile
3) Under general, clear out what it is "Profile Name" so its empty.
4) Click apply
5) "Sorry - Konsole" KMessageBox appears and is unresponsive

I'm starting to wonder if this is related to KMessageBox - which both kwin_kill_helper and konsole both use.
Comment 3 Lukas Sabota 2018-08-22 19:07:12 UTC
I would like to add that I am not able to reproduce this issue on my other PC running Arch Linux 64 and plasma.

That being said - this is extremely strange behavior with a high chance of losing work if you are affected by this bug - so I want to try to get to the bottom of the issue.  I'm not entirely sure what output would help in resolving this issue - but please let me know if anyone has any ideas
Comment 4 Lukas Sabota 2018-08-22 19:19:30 UTC
I apologize for all the noise on this thread but I believe I have found the culprit:  phonon-gstreamer

When KMessageBox is raised, it attempts to play the default notification sound.  In my configuration, when I have "phonon-vlc" as the preferred backend in kcm module "Multimedia->Audio and Video->Backend", the sound is played properly and the "Paste Warning" dialogs and "Sorry" dialogs do not crash the application.

However - for some reason when i am using the phonon-gstreamer backend, I do not hear any notification sound when the KMessageBox dialogs are raised and the KMessageBox also hangs the application.  It seems that whatever is trying to playy
Comment 5 Lukas Sabota 2018-08-22 19:23:13 UTC
(continued) However - for some reason when i am using the phonon-gstreamer backend, I do not hear any notification sound when the KMessageBox dialogs are raised and the KMessageBox also hangs the application.  It seems that whatever is trying to play the notification sound is getting hung up.  I would hope that if the phonon backend is not able to play a sound that instead of crashing the application, it would just not play the sound so the application could continue running.

I will be using Phonon-VLC as my preferred phonon as a workaround to this issue - however I would like to get the bottom of the gstreamer issue to prevent a sound backend problem from crashing kde applications

Again - I apologize for all of the noise on this issue - but this has been a very serious issue in my use-case and I would really like to get it resolved so no one has to deal with this headache
Comment 6 Lukas Sabota 2018-08-22 20:43:34 UTC
In testing this with a totally new user on my machine, I have noticed that I had to be running JACK in order to run into this issue with the gstreamer backend.  It seems (in my case anyway) that the VLC backend has no problem passing the audio to a Jack sink.  But when using the gstreamer backend, phonon is unable to pass audio to the jack sink (and crashes applications in trying to do so).

I think one should be able to reproduce this issue with the following steps:
1) Have JACK installed and phonon-gstreamer
2) Start JACK
3) Ensure that phonon-gstreamer backend is enabled in "System Settings -> Multimedia -> Audio and Video - > Backend"
4) Ensure that "Jack sink" is the default audio playback preference in "System Settings -> Multimedia -> Audio and Video -> Device Preference"
5) Apply audio and video settings
6) We need to trigger a KMessageBox that plays a sound.  An easy way to do this is with konsole.  Open a new console process and go to "Settings->Edit Current Profile"
7) Attempt to change profile name to "" and hit "Apply"

The KMessageBox should hang and the subsequent kwin_kill_helper dialogs will also hang while attempting to play the notification sound with the JACK sink enabled.

I'm changing component to "phonon-gstreamer" in attempt to clean up this bug.  Hope the noise isn't too bad - I keep uncovering more useful information about this issue

Note that this does work with the VLC backend (not only does it not crash, but the sound does play)
Comment 7 Kai Uwe Broulik 2018-08-23 09:11:07 UTC
I ported KNotifications to use libcanberra lately, can you retry with KDE Frameworks 5.50?
Comment 8 Lukas Sabota 2018-08-23 13:08:55 UTC
(In reply to Kai Uwe Broulik from comment #7)
> I ported KNotifications to use libcanberra lately, can you retry with KDE
> Frameworks 5.50?

I would be happy to try this.  What git repos would I need to compile for "KDE Frameworks"?  I have a "kdesrc-build" tree in my home directory but I'm not sure what I would need to build to pick up this libcanberra backend for notifications

Thanks!
Comment 9 Kai Uwe Broulik 2018-08-23 13:09:44 UTC
You need libcanberra (including its dev packages installed) and then build the knotifications framework
Comment 10 Lukas Sabota 2018-08-23 13:19:36 UTC
(In reply to Kai Uwe Broulik from comment #9)
> You need libcanberra (including its dev packages installed) and then build
> the knotifications framework

Thanks Kai!

I was able to build knotifications with the august 8th commit for libcanberra support (f03443cfb) and then build konsole against that.  When konsole is built against knotifications that is using libcanberra, notifications are played when the JACK server is running and I do not encounter a crash and the notification is played on the JACK server (as expected)
Comment 11 Lukas Sabota 2018-08-23 21:17:42 UTC
I have been doing further testing with JACK and phonon-gstreamer on my system.  phonon-gstreamer seems to work fine outputting to a JACK sink in most circumstances.  I tested the "Test" button in the Multimedia kcm module, tested playing music with dragon, and tested playing blinken with sound enabled.  I believe all of these use phonon (and I was set to use gstreamer backend) and they all played audio to my JACK server.

For whatever reason it is only notifications played within applications while using phonon-gstreamer and JACK where we have crashing applications.
Comment 12 Nate Graham 2022-11-24 02:29:49 UTC
This backend for Phonon is no longer maintained or supported, and has not been for quite some time. Please use the VLC backend instead--which is the recommended and maintained replacement--and see if you can reproduce the issue there. If you can, please open a new bug report at https://bugs.kde.org/enter_bug.cgi?product=phonon-backend-vlc.

Thanks a lot!