Bug 483008 - Turning off external monitor causes kwin crash
Summary: Turning off external monitor causes kwin crash
Status: ASSIGNED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 6.0.3
Platform: Arch Linux Linux
: NOR crash
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: qt6
: 483125 485182 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-03-09 17:01 UTC by agapp11@hotmail.com
Modified: 2024-04-16 02:49 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.3


Attachments
gdb.log file (33.05 KB, text/x-log)
2024-03-11 13:47 UTC, agapp11@hotmail.com
Details
gdb.txt with backtrace (92.01 KB, text/plain)
2024-03-11 13:54 UTC, agapp11@hotmail.com
Details
Crash of kwin immediately after the crash after waking computer from sleep and turning on monitor (20.57 KB, text/x-log)
2024-03-13 06:50 UTC, agapp11@hotmail.com
Details
Coredump using sudo DEBUGINFOD_URLS="https://debuginfod.archlinux.org/" coredumpctl gdb kwin_wayland (45.74 KB, text/x-log)
2024-03-15 13:48 UTC, agapp11@hotmail.com
Details
Kwin_wayland crash on Plasma 6.03 (46.53 KB, text/x-log)
2024-03-30 17:56 UTC, agapp11@hotmail.com
Details

Note You need to log in before you can comment on or make changes to this bug.
Description agapp11@hotmail.com 2024-03-09 17:01:51 UTC
SUMMARY
***

Turning off external monitor with a laptop in clamshell mode using hybrid nvidia gpu, and letting computer go to sleep will cause kwin to crash.

NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

Unable to backtrace as `sudo coredumpctl gdb` will cause my root partition to run out of memory. Here is a reddit thread on the topic:

https://old.reddit.com/r/kde/comments/1b9t888/coredump_kwin_wayland_crashes_plasma_6/

STEPS TO REPRODUCE
1. Make sure there is no sleep blocking going on
2. Turn off external monitor connected via usbc
3. Let computer sleep
4. kwin_wayland will crash and present a dialog:
https://imgur.com/a/dpoDFSM


OBSERVED RESULT

Dr Konqi presents a crash report

EXPECTED RESULT

Normally login and continue doing what i was doing without crashes

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.9-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ i7-10750H CPU @ 2.60GHz
Memory: 23.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Manufacturer: LENOVO
Product Name: 81Y6
System Version: Lenovo Legion 5 15IMH05H

Nvidia 2060 mobile graphics
Comment 1 fanzhuyifan 2024-03-09 17:22:14 UTC
Unfortunately we would need a backtrace with debug symbols :(

See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports for instructions.

Maybe adding some swap would fix the OOM problem?
Comment 2 agapp11@hotmail.com 2024-03-09 19:03:10 UTC
(In reply to fanzhuyifan from comment #1)
> Unfortunately we would need a backtrace with debug symbols :(
> 
> See
> https://community.kde.org/Guidelines_and_HOWTOs/Debugging/
> How_to_create_useful_crash_reports for instructions.
> 
> Maybe adding some swap would fix the OOM problem?

Its not a ram issue - I have a 10GB swap file. I only have 3 Gbs on root partition remaining and the backtrace generated fails with "SEGFAULT INTERNAL ERROR" that seems to be related to runninng out of memory.

Is it possible to have the backtrace saved to my /home/ partition?
Comment 3 agapp11@hotmail.com 2024-03-09 19:04:15 UTC
FYI this is for `sudo coredumpctl gdb`, I don't know how to do anything else as the instructions don't make sense to me.
Comment 4 agapp11@hotmail.com 2024-03-11 13:46:49 UTC
(In reply to agapp11@hotmail.com from comment #2)
> (In reply to fanzhuyifan from comment #1)
> > Unfortunately we would need a backtrace with debug symbols :(
> > 
> > See
> > https://community.kde.org/Guidelines_and_HOWTOs/Debugging/
> > How_to_create_useful_crash_reports for instructions.
> > 
> > Maybe adding some swap would fix the OOM problem?
> 
> Its not a ram issue - I have a 10GB swap file. I only have 3 Gbs on root
> partition remaining and the backtrace generated fails with "SEGFAULT
> INTERNAL ERROR" that seems to be related to runninng out of memory.
> 
> Is it possible to have the backtrace saved to my /home/ partition?

I have finally figured out how to create a backtrace. Or at least think I have. It is attached, let me know if it worked
Comment 5 agapp11@hotmail.com 2024-03-11 13:47:36 UTC
Created attachment 166954 [details]
gdb.log file
Comment 6 agapp11@hotmail.com 2024-03-11 13:54:48 UTC
Created attachment 166956 [details]
gdb.txt with backtrace

I have managed to get a backtrace to show up in the .txt. Let me know if anyhting else is needed.
Comment 7 Méven Car 2024-03-12 11:49:33 UTC
(In reply to agapp11@hotmail.com from comment #6)
> Created attachment 166956 [details]
> gdb.txt with backtrace
> 
> I have managed to get a backtrace to show up in the .txt. Let me know if
> anyhting else is needed.

This is nice and even more detailed that what I would expect normally ;)

But I am not sure what this trace is for. If you use gdb, it should mention a segfault or a crash somewhere but this does not seem to be the case.

With gdb, you need to launch or attach to kwin process, and get it to crash, then we will have a useful trace in gdb output.

Or with coredumpctl after kwin has quit after a crash, you can run `coredumpctl info -1 kwin_wayland` to get essentially the same thing.
Comment 8 agapp11@hotmail.com 2024-03-13 06:48:33 UTC
(In reply to Méven Car from comment #7)
> (In reply to agapp11@hotmail.com from comment #6)
> > Created attachment 166956 [details]
> > gdb.txt with backtrace
> > 
> > I have managed to get a backtrace to show up in the .txt. Let me know if
> > anyhting else is needed.
> 
> This is nice and even more detailed that what I would expect normally ;)
> 
> But I am not sure what this trace is for. If you use gdb, it should mention
> a segfault or a crash somewhere but this does not seem to be the case.
> 
> With gdb, you need to launch or attach to kwin process, and get it to crash,
> then we will have a useful trace in gdb output.
> 
> Or with coredumpctl after kwin has quit after a crash, you can run
> `coredumpctl info -1 kwin_wayland` to get essentially the same thing.

I can't consistently reproduce the crash so I can't use gdb.

It finally crashed again so using the coredump command I have attached the output
Comment 9 agapp11@hotmail.com 2024-03-13 06:50:09 UTC
Created attachment 167081 [details]
Crash of kwin immediately after the crash after waking computer from sleep and turning on monitor

One thing I noticed is the crash of kwin only happens when Optimus-manager is running in the tray. I have not observed it happen without it.
Comment 10 Méven Car 2024-03-13 08:44:11 UTC
(In reply to agapp11@hotmail.com from comment #9)
> Created attachment 167081 [details]
> Crash of kwin immediately after the crash after waking computer from sleep
> and turning on monitor
> 
> One thing I noticed is the crash of kwin only happens when Optimus-manager
> is running in the tray. I have not observed it happen without it.

This lacks debuginfo that would make it 100 times more useful, luckily that can be added easily.
For arch/Endeavour and reading your precedent output it should be as simple as running `DEBUGINFOD_URLS="https://debuginfod.archlinux.org/" coredumpctl gdb 1973961`, this will take a little while and download a bunch of data.
Once the last line is a prompt `(gdb) `, type in `bt` then hit enter and you will have a good output.
You can quit gdb with Ctrl + D or close your terminal afterwards.
Comment 11 agapp11@hotmail.com 2024-03-15 13:46:44 UTC
(In reply to Méven Car from comment #10)
> (In reply to agapp11@hotmail.com from comment #9)
> > Created attachment 167081 [details]
> > Crash of kwin immediately after the crash after waking computer from sleep
> > and turning on monitor
> > 
> > One thing I noticed is the crash of kwin only happens when Optimus-manager
> > is running in the tray. I have not observed it happen without it.
> 
> This lacks debuginfo that would make it 100 times more useful, luckily that
> can be added easily.
> For arch/Endeavour and reading your precedent output it should be as simple
> as running `DEBUGINFOD_URLS="https://debuginfod.archlinux.org/" coredumpctl
> gdb 1973961`, this will take a little while and download a bunch of data.
> Once the last line is a prompt `(gdb) `, type in `bt` then hit enter and you
> will have a good output.
> You can quit gdb with Ctrl + D or close your terminal afterwards.

I finally got another crash. I tried using the command you specified but it did not work as it gave an output of "no match found".

Using `sudo DEBUGINFOD_URLS="https://debuginfod.archlinux.org/" coredumpctl gdb kwin_wayland` I got the output attached
Comment 12 agapp11@hotmail.com 2024-03-15 13:48:28 UTC
Created attachment 167259 [details]
Coredump using sudo DEBUGINFOD_URLS="https://debuginfod.archlinux.org/" coredumpctl gdb kwin_wayland

I hope it is correct and useful this time. Please let me know
Comment 13 Méven Car 2024-03-15 13:55:21 UTC
(In reply to agapp11@hotmail.com from comment #12)
> Created attachment 167259 [details]
> Coredump using sudo DEBUGINFOD_URLS="https://debuginfod.archlinux.org/"
> coredumpctl gdb kwin_wayland
> 
> I hope it is correct and useful this time. Please let me know

Yes fantastic !

(gdb) bt
#0  doActivate<false> (sender=0x723878002840, signal_index=3, argv=0x7fffb699e490) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/tools/qscopedpointer.h:110
#1  0x00007238c73e8c07 in KWin::DrmGpu::activeChanged (_t1=<optimized out>, this=0x723878002840) at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_drm_gpu.cpp:333
#2  KWin::DrmGpu::setActive (this=0x723878002840, active=true) at /usr/src/debug/kwin/kwin-6.0.2/src/backends/drm/drm_gpu.cpp:734
#3  0x00007238c4b90ca9 in QtPrivate::QSlotObjectBase::call (a=0x7fffb699e5d0, r=0x7238b8009810, this=0x60e9eb54f5a0, this=<optimized out>, r=<optimized out>, a=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobjectdefs_impl.h:433
#4  doActivate<false> (sender=0x60e9eb54a960, signal_index=5, argv=0x7fffb699e5d0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobject.cpp:4039
#5  0x00007238c717edd7 in KWin::Session::deviceResumed (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_session.cpp:236
#6  0x00007238c718b9bb in KWin::LogindSession::handleResumeDevice (fileDescriptor=..., minor=<optimized out>, major=<optimized out>, this=0x60e9eb54a960)
    at /usr/src/debug/kwin/kwin-6.0.2/src/core/session_logind.cpp:330
#7  KWin::LogindSession::qt_static_metacall (_o=0x60e9eb54a960, _id=<optimized out>, _a=0x7fffb699e848, _c=<optimized out>)
    at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_session_logind.cpp:176
#8  0x00007238c718bbf1 in KWin::LogindSession::qt_static_metacall (_a=0x7fffb699e848, _id=0, _c=QMetaObject::InvokeMetaMethod, _o=0x60e9eb54a960)
    at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_session_logind.cpp:170
#9  KWin::LogindSession::qt_metacall (this=0x60e9eb54a960, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffb699e848)
    at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_session_logind.cpp:216
#10 0x00007238c61130ce in QDBusConnectionPrivate::deliverCall (this=0x7238b8009370, object=0x60e9eb54a960, msg=..., metaTypes=<optimized out>, slotIdx=9)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/dbus/qdbusintegrator.cpp:977
#11 0x00007238c4b7c2c7 in QObject::event (this=0x60e9eb54a960, e=0x7238b8010dc0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobject.cpp:1437
#12 0x00007238c5af438b in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x60e9eb54a960, e=0x7238b8010dc0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:3296
#13 0x00007238c4b39818 in QCoreApplication::notifyInternal2 (receiver=0x60e9eb54a960, event=event@entry=0x7238b8010dc0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1121
#14 0x00007238c4b39b9b in QCoreApplication::sendEvent (event=0x7238b8010dc0, receiver=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1539
#15 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x60e9eb412430)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1901
#16 0x00007238c4c9f18f in QEventDispatcherUNIX::processEvents (this=0x60e9eb47f460, flags=flags@entry=...)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventdispatcher_unix.cpp:431
#17 0x00007238c55b26e2 in QUnixEventDispatcherQPA::processEvents (this=<optimized out>, flags=...)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/gui/platform/unix/qunixeventdispatcher.cpp:27
#18 0x00007238c4b43d6e in QEventLoop::processEvents (flags=..., this=0x7fffb699edb0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventloop.cpp:100
#19 QEventLoop::exec (this=0x7fffb699edb0, flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventloop.cpp:182
#20 0x00007238c4b3c2b8 in QCoreApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/global/qflags.h:74
#21 0x00007238c5af0f0a in QApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:2574
#22 0x000060e9e99d3dee in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kwin/kwin-6.0.2/src/main_wayland.cpp:609
Comment 14 Bug Janitor Service 2024-03-15 14:38:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5433
Comment 15 Zamundaaa 2024-03-15 14:45:06 UTC
*** Bug 483125 has been marked as a duplicate of this bug. ***
Comment 16 Méven 2024-03-15 16:41:26 UTC
Git commit aa465efa5178c240059f6d974440cfb85bea99d2 by Méven Car.
Committed on 15/03/2024 at 16:31.
Pushed by meven into branch 'master'.

wayland: DrmLeaseDevice, use Q_OBJECT macro

M  +1    -0    src/wayland/drmlease_v1_p.h

https://invent.kde.org/plasma/kwin/-/commit/aa465efa5178c240059f6d974440cfb85bea99d2
Comment 17 Méven 2024-03-15 17:00:53 UTC
Git commit 84412b22df01c5b00074e486cad3a432b04c953d by Méven Car.
Committed on 15/03/2024 at 16:51.
Pushed by meven into branch 'Plasma/6.0'.

wayland: DrmLeaseDevice, use Q_OBJECT macro
(cherry picked from commit aa465efa5178c240059f6d974440cfb85bea99d2)

M  +1    -0    src/wayland/drmlease_v1_p.h

https://invent.kde.org/plasma/kwin/-/commit/84412b22df01c5b00074e486cad3a432b04c953d
Comment 18 andy 2024-03-16 20:58:24 UTC
Does this look like the same cause affecting https://bugs.kde.org/show_bug.cgi?id=483243 (possible duplicate)
Comment 19 Méven Car 2024-03-18 16:01:16 UTC
(In reply to andy from comment #18)
> Does this look like the same cause affecting
> https://bugs.kde.org/show_bug.cgi?id=483243 (possible duplicate)

This is not not a duplicate but looks a bit similar.
Comment 20 agapp11@hotmail.com 2024-03-30 17:56:05 UTC
It seems that I am still getting kwin_wayland crashes even after updating to plasma 6.03 on arch.

Backtrace is attached
Comment 21 agapp11@hotmail.com 2024-03-30 17:56:40 UTC
Created attachment 167957 [details]
Kwin_wayland crash on Plasma 6.03
Comment 22 Méven Car 2024-03-31 10:14:13 UTC
(In reply to agapp11@hotmail.com from comment #21)
> Created attachment 167957 [details]
> Kwin_wayland crash on Plasma 6.03

[Current thread is 1 (Thread 0x7dac5a90ba00 (LWP 2243))]
(gdb) bt
#0  doActivate<false> (sender=0x5c1be80bd0e0, signal_index=3, argv=0x7ffe55023cd0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/tools/qscopedpointer.h:110
#1  0x00007dac625e9447 in KWin::DrmGpu::activeChanged (_t1=<optimized out>, this=0x5c1be80bd0e0) at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_drm_gpu.cpp:333
#2  KWin::DrmGpu::setActive (this=0x5c1be80bd0e0, active=true) at /usr/src/debug/kwin/kwin-6.0.3.1/src/backends/drm/drm_gpu.cpp:736
#3  0x00007dac5fd90ca9 in QtPrivate::QSlotObjectBase::call (a=0x7ffe55023e10, r=0x7dac54009800, this=0x5c1be7fc9f60, this=<optimized out>, r=<optimized out>, a=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobjectdefs_impl.h:433
#4  doActivate<false> (sender=0x5c1be7fee6e0, signal_index=5, argv=0x7ffe55023e10) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobject.cpp:4039
#5  0x00007dac6237ee37 in KWin::Session::deviceResumed (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_session.cpp:236
#6  0x00007dac6238ba1b in KWin::LogindSession::handleResumeDevice (fileDescriptor=..., minor=<optimized out>, major=<optimized out>, this=0x5c1be7fee6e0)
    at /usr/src/debug/kwin/kwin-6.0.3.1/src/core/session_logind.cpp:330
#7  KWin::LogindSession::qt_static_metacall (_o=0x5c1be7fee6e0, _id=<optimized out>, _a=0x7ffe55024088, _c=<optimized out>)
    at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_session_logind.cpp:176
#8  0x00007dac6238bc51 in KWin::LogindSession::qt_static_metacall (_a=0x7ffe55024088, _id=0, _c=QMetaObject::InvokeMetaMethod, _o=0x5c1be7fee6e0)
    at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_session_logind.cpp:170
#9  KWin::LogindSession::qt_metacall (this=0x5c1be7fee6e0, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7ffe55024088)
    at /usr/src/debug/kwin/build/src/kwin_autogen/include/moc_session_logind.cpp:216
#10 0x00007dac613130ce in QDBusConnectionPrivate::deliverCall (this=0x7dac54009360, object=0x5c1be7fee6e0, msg=..., metaTypes=<optimized out>, slotIdx=9)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/dbus/qdbusintegrator.cpp:977
#11 0x00007dac5fd7c2c7 in QObject::event (this=0x5c1be7fee6e0, e=0x7dac54025100) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobject.cpp:1437
#12 0x00007dac60cf438b in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5c1be7fee6e0, e=0x7dac54025100)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:3296
#13 0x00007dac5fd39818 in QCoreApplication::notifyInternal2 (receiver=0x5c1be7fee6e0, event=event@entry=0x7dac54025100)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1121
#14 0x00007dac5fd39b9b in QCoreApplication::sendEvent (event=0x7dac54025100, receiver=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1539
Comment 23 Bug Janitor Service 2024-04-01 08:35:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5539
Comment 24 Zamundaaa 2024-04-10 11:34:09 UTC
*** Bug 485182 has been marked as a duplicate of this bug. ***
Comment 25 agapp11@hotmail.com 2024-04-16 02:49:18 UTC
Any update on this? It is quite bothersome to have your desktop and apps crash every time you wake from sleep? Is there anything else I need to include? Perhaps another backtrace?