https://bugs.kde.org/show_bug.cgi?id=501061

            Bug ID: 501061
           Summary: Log Backtrace Automatically when KWin Crashes
    Classification: Plasma
           Product: plasmashell
           Version: master
          Platform: unspecified
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: Startup process
          Assignee: plasma-b...@kde.org
          Reporter: stellarpo...@googlemail.com
                CC: k...@davidedmundson.co.uk
  Target Milestone: 1.0

Feature request:

A backtrace for Kwin may be obtained when running Plasma using the instructions
[here](https://community.kde.org/KWin/Debugging#TL;DR_for_bug_reporters). 

This is a little bit non-trivial; I haven't tried this for X11, but for
Wayland, an SSH session is mandatory, and if using a login manager, it requires
one to log in separately over the network, set things up, then go back into the
desktop session. Because I'm on an NVidia system, I sometimes find SDDM is a
bit wobbly, sometimes things freeze up when changing TTYs, and sometimes
starting a shell from the TTY produces different behaviour from starting it
through SDDM.

>From experience (I've not yet read the code, so I don;t know the full
architecture), startplasma-wayland appears to run KWin in a crashloop - i.e.
when KWin does crash, I usually get a fresh blank desktop, and I see a
kwin_wrapper process running. What I'd like to propose, is ask if it is
possible for plasma to run that kwin session under gdb/another system debugger
(maybe only LLDB is installed, but this would be an enhancement), and
automatically log a backtrace to journalctl (or another place if more
appropriate). That way, the information may be obtained in a more preventative
manner, however it is I start the desktop, rather than needing explicit steps
form me first.


Personally, and very unfortunately, I am running this system where I need an
NVidia card. On top of that the motherboard has an integrated VGA header (for
headless server use), so it's in effect a multi-GPU setup. Thus desktop crashes
have been a relatively common experience for a long time using various distros.
The logs are often filled with error messages that may be ignored, and then
suddenly when I do experience a crash, bisecting the point at which something
actually failed is quite tricky. A backtrace is somewhat less ambiguous, at the
leats I should be able to see what actually failed, and the logs may then help
in working out why. Without always knowing what will precipitate a crash, it's
hard for me to forcibly reproduce one, and as plasma is my desktop, according
to Murphy's law it happens right when I am in the middle of something, have
lots of unsaved work, and no time to investigate properly. 

Therefore, I think the process of generating more debug information when KWin
crashes might help with development quite a lot. I've seen many bugs under all
desktops with the transition to Wayland and especially with Nvidia, so whilst
the linked article is helpful, I hope having an automatic process (if possible
- maybe it just isn't) might help squash some of these.

# Possible implementations

Producing the backtrace would generally require the debug symbols to be
installed, as well as an appropriate debugger. Therefore, I see two possible
ways to achieve this:

1) Automatically sense on startup if the prerequisites are installed; if so,
launch KWin under a debugger and dump the crash information in Plasma's
crashloop.
2) Add a separate startplasma-... command and login manager session (e.g.
Plasma (Wayland; debug)). Downstream packagers could consider adding these with
the debug symbols for the package, so that normal users without symbols
installed would not see it in their options. If the required dependencies are
not detected, do not start the desktop, and exit.

Also, I'm not necessarily recommending that this would be something that would
be installed or burden the average user. Running kwin under a debugger should
carry performance implications, so this ought to be an opt-in step for someone
who is experiencing crashes to follow. It should also be something that can be
enabled or disabled easily, so that a user can differentiate between a normal
and a debug desktop session as appropriate, again akin to installing debug
symbols for a package. The idea is to make it easier for a user familiar with
sysadmin and collecting logs and debug information, but not necessarily as
familiar with the complexities of doing so for a desktop session and
specifically for KWin/Plasma, to be able to provide the developers with
required diagnostic information. Unless it's possible to achieve this without a
penalty (which I don't think it is, my own applications run much slower when
reading in symbols, but will happily stand corrected, I don;t know much about
coredumpctl and friends), then they probably shouldn't pay the price.

Thanks for the continued work! Having migrated to SUSE, it's nice to see
wayland support steadily coming along during a pretty rocky few years for the
linux world.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to