Bug 463334 - kwin_wayland sometimes crashes when connecting to docking station
Summary: kwin_wayland sometimes crashes when connecting to docking station
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (show other bugs)
Version: 5.26.4
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-12-22 11:11 UTC by dominik.klementowski
Modified: 2022-12-31 04:56 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.26.5


Attachments
journalctl -b | grep kwin_wayland - no debug symbols (27.15 KB, text/plain)
2022-12-22 11:11 UTC, dominik.klementowski
Details
journalctl -b - still no debug symbols (13.61 KB, text/plain)
2022-12-22 11:12 UTC, dominik.klementowski
Details
Backtrace (5.74 KB, text/plain)
2022-12-28 00:36 UTC, dominik.klementowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dominik.klementowski 2022-12-22 11:11:53 UTC
Created attachment 154754 [details]
journalctl -b | grep kwin_wayland - no debug symbols

SUMMARY
***
This is something that actually didn't happen before, and I use Wayland session since 5.24, although I previously used Arch Linux and only recently switched to Fedora.

I use USB-C Dell WD19S docking station that is connected to 2 1080p screens and ethernet cable. Te dock was always a little bit junky regardless to what software I used, but with a little hiccups it works as expected (sometimes I need to re-plug it when it fails to activate screens, my laptop freezes for few seconds after it's connected). Since 5.24 it was also fine on kwin_wayland and didn't cause crashes (before that it wasn't usable at all, it was crashing and misbehaving like crazy).

The crash today happened just like it did when I last was in the office. I resumed from suspend, unlocked it, connected the dock and then kwin_wayland died along with everything that was running.

Sadly I don't currently have backtrace with debug symbols and the issue is not easily reproducible - it stops happening completely when I restart the docking station. Well, even if it's purely because of that dock it shouldn't cause the entire compositor to crash.

I collected 2 log files from `journalctl -b`. It casually crashed now when writing the report when I tried to check installed firmware using fwupdmgr (yes, it is supported and the firmware is up-to-date).
Now I installed kwin-debuginfo and kwin-wayland-debuginfo packages. When the crash will happen again, I should be able to fetch some more useful logs, I'll come back here with it.
***


STEPS TO REPRODUCE
1. Resume laptop from sleep after some longer usage
2. Connect do Dell WD19S docking station with multiple screens

OBSERVED RESULT
kwin_wayland segfault

EXPECTED RESULT
Even when the dock connection is wanky, keep kwin_wayland working

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 6.0.14-300.fc37.x86_64
(available in About System)
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION
Comment 1 dominik.klementowski 2022-12-22 11:12:26 UTC
Created attachment 154755 [details]
journalctl -b - still no debug symbols
Comment 2 dominik.klementowski 2022-12-22 12:05:34 UTC
I think I've got the coredump, although i'm not experienced with debugging at all, so I don't know exactly what I'm doing.

Fedora has its abrt tool that is preinstalled for automated bug reports. It stores files for every crash in a directory. Among many files with info in that directory there is coredump in form of binary blob. It weights 269MB (!), so I cannot post it directly as an attachement here.
https://www.dropbox.com/s/ntzd34pm3xlmrhy/kwin-coredump.tar.gz?dl=1

I roughly checked how to interact with coredumps using gdb and after downloading debug info for dependencies it printed this:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
--Type <RET> for more, q to quit, c to continue without paging--
Core was generated by `/usr/bin/kwin_wayland --wayland-fd 7 --socket wayland-0 --xwayland-fd 8 --xwayl'.
cProgram terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fe9f8972938 in KWin::DrmConnectorMode::~DrmConnectorMode (this=<optimized out>, this=<optimized out>)
    at /usr/src/debug/kwin-5.26.4-1.fc37.x86_64/src/backends/drm/drm_object_connector.cpp:71
71              drmModeDestroyPropertyBlob(m_connector->gpu()->fd(), m_blobId);
[Current thread is 1 (Thread 0x7fe9f19f0980 (LWP 1891))]
Comment 3 Zamundaaa 2022-12-27 20:24:44 UTC
Can you post the full backtrace? You can enter "bt" into gdb to get it.
Comment 4 dominik.klementowski 2022-12-28 00:36:14 UTC
Created attachment 154857 [details]
Backtrace
Comment 5 dominik.klementowski 2022-12-28 00:46:02 UTC
(In reply to Zamundaaa from comment #3)
> Can you post the full backtrace? You can enter "bt" into gdb to get it.

Just added as attachment.

One more thing as an afterthought: the dock was restarting several times after it was connected. It has LED on the connector + there was simply sound from plasma indicating power connects and disconnects. My blind guess is that maybe it tries to interact with something that disappears, but I don't know.
Comment 6 Bug Janitor Service 2022-12-28 22:08:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3372
Comment 7 Zamundaaa 2022-12-30 16:17:28 UTC
Git commit 239207c5eee6c042582c8b5769745892d5d994db by Xaver Hugl.
Committed on 30/12/2022 at 14:53.
Pushed by zamundaaa into branch 'master'.

backends/drm: extend connector lifetime to match their outputs

As disconnected outputs outlive DrmGpu::updateOutputs, the DrmConnector
and DrmPipeline must also be kept valid for that time

M  +2    -2    src/backends/drm/drm_gpu.cpp
M  +1    -1    src/backends/drm/drm_gpu.h
M  +5    -6    src/backends/drm/drm_output.cpp
M  +2    -2    src/backends/drm/drm_output.h

https://invent.kde.org/plasma/kwin/commit/239207c5eee6c042582c8b5769745892d5d994db
Comment 8 Zamundaaa 2022-12-30 19:20:54 UTC
Git commit 3a5eda5fe98f64d94f3d8e796e3cfba4f289c257 by Xaver Hugl.
Committed on 30/12/2022 at 18:14.
Pushed by zamundaaa into branch 'Plasma/5.26'.

backends/drm: extend connector lifetime to match their outputs

As disconnected outputs outlive DrmGpu::updateOutputs, the DrmConnector
and DrmPipeline must also be kept valid for that time
(cherry picked from commit 239207c5eee6c042582c8b5769745892d5d994db)

M  +2    -2    src/backends/drm/drm_gpu.cpp
M  +1    -1    src/backends/drm/drm_gpu.h
M  +5    -6    src/backends/drm/drm_output.cpp
M  +2    -2    src/backends/drm/drm_output.h

https://invent.kde.org/plasma/kwin/commit/3a5eda5fe98f64d94f3d8e796e3cfba4f289c257