Bug 406140 - "sudo emacs" makes plasmashell run at 100% CPU
Summary: "sudo emacs" makes plasmashell run at 100% CPU
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 5.14.5
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-02 08:09 UTC by dhekir
Modified: 2021-03-10 23:51 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dhekir 2019-04-02 08:09:56 UTC
SUMMARY
When I run 'sudo emacs' in KDE, the graphical interface freezes due to 100% CPU usage by plasmashell. I am forced to switch to a terminal (Ctrl+Alt+F2), then kill all Emacs processes before I can use the interface again.
Using the terminal, I see that there is a plasmashell process running at 100% CPU. Killing Emacs restores things to normal.

STEPS TO REPRODUCE
1. run 'sudo emacs'
2. KWin freezes with 100% CPU usage

OBSERVED RESULT
Unusable interface.

EXPECTED RESULT
Emacs should open normally.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora 29
(available in About System)
KDE Plasma Version: 5.14.5
KDE Frameworks Version: 5.55.0
Qt Version: 5.11.3

ADDITIONAL INFORMATION
I have Fedora 29 on a different machine (both are Lenovo laptops) and 'sudo emacs' has been working for years. The main difference is the new machine has an Nvidia card with Optimus, so I had to install proprietary drivers otherwise I couldn't even boot into X.

Emacs seems to be the only application which does this. 'sudo gparted', 'sudo libreoffice', etc, all work normally. Running Emacs without sudo works normally.

After killing emacs via a terminal, when I switch back to the terminal running KWin, the following notification is visible:

"KWin Window Manager" - desktop effects were restarted due to a graphics reset.

I'm almost sure the bug is related to the Nvidia proprietary drivers, but I wonder if there is a way to disable something in KDE that would allow it to work again, or at least a way to better diagnose why running Emacs as sudo causes this behavior.
Comment 1 David Edmundson 2019-04-02 09:01:37 UTC

>I see that there is a plasmashell process running at 100% 
>KWin freezes with 100% CPU usage


These are different processes. Please can you clarify.
Comment 2 dhekir 2019-04-02 09:40:25 UTC
Sorry, I meant "the entire graphical interface freezes", as in, I can move the mouse pointer but clicking anywhere or pressing the keyboard does nothing; nothing is refreshed other than the mouse pointer position.

However, I tried causing it again, and this time I have not only plasmashell running at 100% CPU, but also "/usr/bin/kwin_x11 --crashes 1", also indicated at 100% CPU usage.
Comment 3 dhekir 2019-04-02 12:10:53 UTC
A few more tests, in case it might help:

- Running "kdesu emacs" produces the same result as a simple "sudo emacs", except for the password prompt, before the interface freezes.

- If I run "sudo emacs" on a Konsole, for instance, and do nothing other than a Ctrl+C (I can wait several seconds, and hear the CPU fan spinning), the Ctrl+C works. However, if I do something as simple as moving the mouse cursor around, then Ctrl+C no longer works, and I have to Ctrl+Alt+F2 and kill emacs from the terminal.

- When I succesfully Ctrl+C Emacs, the following message appears in the terminal:

** (emacs:9664): CRITICAL **: 14:02:48.372: Failed to get connection to xfconfd: Error spawning command line “dbus-launch --autolaunch=13e6db43a6d747cd9b7b168d166b6703 --binary-syntax --close-stderr”: Child process killed by signal 2

This message never appears when I Ctrl+C a "normal" Emacs (without running with sudo).
Comment 4 Bug Janitor Service 2019-04-17 04:33:08 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 dhekir 2019-04-17 07:16:45 UTC
I did report it in my comments, but I expected the status to update accordingly. I'm adding this comment just so that it allows me to change the status to REPORTED.
Comment 6 David Edmundson 2021-03-10 23:51:54 UTC
We don't have enough data to do anything with this.