Bug 497436

Summary: Primary monitor desktop environment breaks after monitor sleep or shutoff (or randomly), black screen and panels move to secondary monitor
Product: [Plasma] plasmashell Reporter: Max Sloan <maxsloan44>
Component: ContainmentAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: major CC: nate, notmart, xaver.hugl
Priority: NOR Keywords: multiscreen
Version First Reported In: 6.2.4   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Max Sloan 2024-12-13 23:07:39 UTC
SUMMARY
Please excuse any mistakes or flaws, this is my first bug submission. 
I have been having issues keeping my primary monitor working correctly. There seem to be a few situations in which it has consistently happened:
1. When performing some action on my primary monitor, typically opening an app like Dolphin. Oddly enough it happened a couple times when trying to browse the files for a Timeshift image by right-clicking and selecting that option.
2. When any type of auto-sleep or suspend occurs. I have since disabled these options for this reason.
3. When the monitor is manually shut off with its power button.

There has also been some variation in exactly what happens when I have this issue. I have since disabled any type of auto-sleep or suspend because this issue irritated me so much, but when I was having problems with this monitor previously due to suspend and autosleep, rather than the desktop environment simply breaking, my monitor and system would stop communicating at all, and my monitor would display "no signal" and enter power saving mode.

Now, when I have issues with the primary monitor, it continues to communicate with the system in that it still exchanges a signal, but the desktop environment breaks and my panels move to my secondary monitor, my desktop background goes black, but my cursor and any windows remain on my primary monitor. When this occurs, making some change to the display configuration (i.e. changing refresh rate, etc.) seems to kick things back into gear and my desktop will right itself, and my panels will move back over and my wallpaper will come back. So, I have the capability of fixing the issue when it arises, but it's a huge pain. I've seen a lot of similar bugs on this tracker that all seem to reach a dead-end or involve different components than mine, which leads me to believe this is not a hardware issue, but an issue with the system itself.

STEPS TO REPRODUCE
1. Turn off primary monitor
2. Turn it back on

OBSERVED RESULT
After monitor shuts off, panels move to secondary monitor. Upon primary monitor powering back on, primary's panels remain on second monitor and primary monitor's desktop background is black, but windows and cursor still remain. Sometimes panels don't move until the primary monitor is powered back on, it isn't very consistent.

EXPECTED RESULT
Panels will stay where they belong regardless of monitor power state and turning the monitor back on will return me to my normal, functioning desktop

SOFTWARE/OS VERSIONS
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux: Arch Linux, 6.12.1-arch1-1 kernel
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0

ADDITIONAL INFORMATION
I am using an X11 session, AMD Ryzen 7 5800X processor, AMD Radeon RX 6800 XT GPU.
As I mentioned, display configuration changes fix the issue when it occurs. It seems to refresh the system somehow and will move everything back to where it belongs and restore my desktop wallpaper.
I also have a DisplayPort adapter on both monitors' HDMI cords (monitor-side are HDMI, PC-side is DisplayPort), but issue continues to reproduce when plugged directly into HDMI instead of DisplayPort. I have both monitors on displayport adapters because if one is displayport and one is HDMI, my boot screen is always on my secondary monitor which bugs me.
plasmashell is still running after this issue occurs, so it doesn't seem that plasmashell is crashing.
Even when the panel moves to the secondary monitor, the actual primary monitor is still accurately indicated as the primary monitor.
When the panels move like this, the panels that SHOULD be on my second monitor completely disappear, and my secondary monitor gains the primary monitor's desktop background and icons as well as the panels. It's like it's literally taking the place of my secondary monitor.
journalctl output seems to vary, so it's difficult to tell what is the cause of this issue.

gdb output:
[max@maxdesktop ~]$ sudo gdb attach -p $(pidof plasmashell)
[sudo] password for max: 
GNU gdb (GDB) 15.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
attach: No such file or directory.
Attaching to process 1561
[New LWP 533980]
[New LWP 533979]
[New LWP 533978]
[New LWP 533977]
[New LWP 533973]
[New LWP 533972]
[New LWP 533971]
[New LWP 533970]
[New LWP 525490]
[New LWP 525489]
[New LWP 525488]
[New LWP 525487]
[New LWP 525483]
[New LWP 525482]
[New LWP 525481]
[New LWP 525480]
[New LWP 525454]
[New LWP 525453]
[New LWP 525452]
[New LWP 525451]
[New LWP 403226]
[New LWP 403225]
[New LWP 403224]
[New LWP 218699]
[New LWP 106502]
[New LWP 106501]
[New LWP 106500]
[New LWP 106499]
[New LWP 106496]
[New LWP 106495]
[New LWP 106494]
[New LWP 106493]
[New LWP 106492]
[New LWP 106491]
[New LWP 106490]
[New LWP 106489]
[New LWP 106488]
--Type <RET> for more, q to quit, c to continue without paging--c
[New LWP 106487]
[New LWP 106486]
[New LWP 106485]
[New LWP 106484]
[New LWP 106483]
[New LWP 106482]
[New LWP 106481]
[New LWP 106480]
[New LWP 106479]
[New LWP 106478]
[New LWP 106477]
[New LWP 106476]
[New LWP 106475]
[New LWP 106474]
[New LWP 9812]
[New LWP 9811]
[New LWP 9810]
[New LWP 9809]
[New LWP 4535]
[New LWP 3724]
[New LWP 3723]
[New LWP 3722]
[New LWP 3721]
[New LWP 3086]
[New LWP 3085]
[New LWP 3084]
[New LWP 3083]
[New LWP 1871]
[New LWP 1870]
[New LWP 1869]
[New LWP 1868]
[New LWP 1863]
[New LWP 1861]
[New LWP 1812]
[New LWP 1769]
[New LWP 1623]
[New LWP 1622]
[New LWP 1621]
[New LWP 1607]
[New LWP 1606]
[New LWP 1605]
[New LWP 1604]
[New LWP 1602]
[New LWP 1601]
[New LWP 1566]
[New LWP 1565]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x000073653051abb0 in ppoll () from /usr/lib/libc.so.6
(gdb) bt
#0  0x000073653051abb0 in ppoll () from /usr/lib/libc.so.6
#1  0x000073652f6cc227 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x000073652f668a55 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x0000736530dbf71d in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt6Core.so.6
#4  0x0000736530b64566 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt6Core.so.6
#5  0x0000736530b59a2f in QCoreApplication::exec() () from /usr/lib/libQt6Core.so.6
#6  0x00006395c9cb217f in ?? ()
#7  0x0000736530434e08 in ?? () from /usr/lib/libc.so.6
#8  0x0000736530434ecc in __libc_start_main () from /usr/lib/libc.so.6
#9  0x00006395c9cb2695 in ?? ()
(gdb) continue
Continuing.
[New Thread 0x7364dbfff6c0 (LWP 534184)]
[New Thread 0x73647a7fc6c0 (LWP 534185)]
[New Thread 0x73647affd6c0 (LWP 534186)]
[Thread 0x73647affd6c0 (LWP 534186) exited]
[Thread 0x73647a7fc6c0 (LWP 534185) exited]
[Thread 0x7364dbfff6c0 (LWP 534184) exited]
[New Thread 0x7364dbfff6c0 (LWP 534187)]
[New Thread 0x73647a7fc6c0 (LWP 534188)]
[New Thread 0x73647affd6c0 (LWP 534189)]
[New Thread 0x736479ffb6c0 (LWP 534190)]
[Thread 0x736479ffb6c0 (LWP 534190) exited]
[Thread 0x73647affd6c0 (LWP 534189) exited]
[Thread 0x73647a7fc6c0 (LWP 534188) exited]
[Thread 0x7364dbfff6c0 (LWP 534187) exited]
[Thread 0x73644a7fc6c0 (LWP 533980) exited]
[Thread 0x73644affd6c0 (LWP 533979) exited]
[Thread 0x73644b7fe6c0 (LWP 533978) exited]
[Thread 0x736454f306c0 (LWP 533977) exited]
[Thread 0x736455ffb6c0 (LWP 533973) exited]
[Thread 0x73646f7fe6c0 (LWP 533972) exited]
[Thread 0x73646ffff6c0 (LWP 533971) exited]
[Thread 0x736478ff96c0 (LWP 533970) exited]
[New Thread 0x736478ff96c0 (LWP 534218)]
[New Thread 0x73646ffff6c0 (LWP 534219)]
[New Thread 0x73646f7fe6c0 (LWP 534220)]
[New Thread 0x736455ffb6c0 (LWP 534221)]
[New Thread 0x7364dbfff6c0 (LWP 534222)]
[New Thread 0x736493fff6c0 (LWP 534223)]
[New Thread 0x7364927ff6c0 (LWP 534224)]
[New Thread 0x736491ffe6c0 (LWP 534225)]
[New Thread 0x73647bfff6c0 (LWP 534284)]
[New Thread 0x73647b7fe6c0 (LWP 534285)]
[New Thread 0x73647affd6c0 (LWP 534286)]
[Thread 0x73647affd6c0 (LWP 534286) exited]
[Thread 0x73647b7fe6c0 (LWP 534285) exited]
[Thread 0x73647bfff6c0 (LWP 534284) exited]
[New Thread 0x73647bfff6c0 (LWP 534287)]
[New Thread 0x73647b7fe6c0 (LWP 534288)]
[New Thread 0x73647affd6c0 (LWP 534289)]
[New Thread 0x73647a7fc6c0 (LWP 534290)]
[Thread 0x73647a7fc6c0 (LWP 534290) exited]
[Thread 0x73647affd6c0 (LWP 534289) exited]
[Thread 0x73647b7fe6c0 (LWP 534288) exited]
[Thread 0x73647bfff6c0 (LWP 534287) exited]
[New Thread 0x73647bfff6c0 (LWP 534306)]
[New Thread 0x73647b7fe6c0 (LWP 534307)]
[New Thread 0x73647affd6c0 (LWP 534308)]
[New Thread 0x73647a7fc6c0 (LWP 534309)]
[New Thread 0x736479ffb6c0 (LWP 534310)]
[Thread 0x736479ffb6c0 (LWP 534310) exited]
[Thread 0x73647a7fc6c0 (LWP 534309) exited]
[Thread 0x73647affd6c0 (LWP 534308) exited]
[New Thread 0x73647affd6c0 (LWP 534311)]
[New Thread 0x73647a7fc6c0 (LWP 534312)]
[New Thread 0x736479ffb6c0 (LWP 534313)]
[New Thread 0x73646effd6c0 (LWP 534314)]
[New Thread 0x7364557fa6c0 (LWP 534315)]
[New Thread 0x736454ff96c0 (LWP 534316)]
[New Thread 0x73644b7fe6c0 (LWP 534317)]
[Thread 0x73644b7fe6c0 (LWP 534317) exited]
[Thread 0x736454ff96c0 (LWP 534316) exited]
[Thread 0x7364557fa6c0 (LWP 534315) exited]
[New Thread 0x7364557fa6c0 (LWP 534318)]
[New Thread 0x736454ff96c0 (LWP 534319)]
[New Thread 0x73644b7fe6c0 (LWP 534320)]
[New Thread 0x73644affd6c0 (LWP 534321)]
[Thread 0x73647b7fe6c0 (LWP 534307) exited]
[Thread 0x73647bfff6c0 (LWP 534306) exited]
[Thread 0x736491ffe6c0 (LWP 534225) exited]
[Thread 0x7364dbfff6c0 (LWP 534222) exited]
[Thread 0x736493fff6c0 (LWP 534223) exited]
[Thread 0x73646f7fe6c0 (LWP 534220) exited]
[Thread 0x736478ff96c0 (LWP 534218) exited]
[Thread 0x7364927ff6c0 (LWP 534224) exited]
[Thread 0x736455ffb6c0 (LWP 534221) exited]
[Thread 0x73646ffff6c0 (LWP 534219) exited]
Comment 1 Max Sloan 2024-12-13 23:09:48 UTC
I am not sure if that gdb output will be useful, so if more information is needed, I would be glad to provide it of course.
Comment 2 Nate Graham 2024-12-16 20:38:01 UTC
We unfortunately have a number of bug reports about similar things, all on X11. Am I correct in assuming that it never happens when you use the Wayland session?
Comment 3 Max Sloan 2024-12-16 21:20:59 UTC
(In reply to Nate Graham from comment #2)
> We unfortunately have a number of bug reports about similar things, all on
> X11. Am I correct in assuming that it never happens when you use the Wayland
> session?

I actually really never use Wayland, so I can't speak to that unfortunately. As of right now I switched over to xfce, but I'm more than willing to keep trying to provide any more information if needed. Even if I lost my patience and moved to a different desktop environment I'd like to be able to help get the bug resolved because it does seem pretty common.
Comment 4 Nate Graham 2024-12-16 21:22:07 UTC
Am I understanding that you no longer have an environment capable of reproducing the issue?
Comment 5 Max Sloan 2024-12-16 21:38:36 UTC
(In reply to Nate Graham from comment #4)
> Am I understanding that you no longer have an environment capable of
> reproducing the issue?

I do still have plasma on my system. I just meant that as a daily driver, I'm using xfce to avoid this bug. But, I do still prefer the features and design of plasma so I'm keeping it on my system and can continue to work with it and troubleshoot.
Comment 6 Nate Graham 2024-12-17 16:29:52 UTC
Ok cool. So would you mind logging into a Plasma Wayland session sometime, to test whether it's only on X11 that it happens?
Comment 7 Max Sloan 2024-12-17 17:19:41 UTC
So I just logged into a Wayland session to test it, and it's... strange. On Wayland, what happens is very similar, but also it immediately resolves itself rather than me having to fix it myself by reloading display configuration settings. When I turn off my monitor, nothing changes, and everything stays where it should be. But when I turn my monitor back on...
1. I get the device disconnect sound, immediately followed by a connect sound, which does NOT happen on X11
2. The panels move to my secondary monitor like in X11, but *immediately* disappear from the secondary monitor, presumably moving back to their correct places
3. My primary monitor takes maybe a second or two longer to turn back on from a black screen, but everything is where it should be and the containment and DE aren't broken. Everything is normal.

So... it's still weird and not quite right, but as opposed to me having to manually "refresh" it myself to kick it back into gear, it takes maybe a couple extra seconds and immediately fixes itself, so I guess using Wayland instead of X11 is a partial workaround? But again, still not quite right... bug still happens, just a lot faster and fixes itself instead. It seems like they're both struggling with the same process but Wayland can recover from it automatically, while X11 simply can't.
Comment 8 Nate Graham 2024-12-20 19:32:45 UTC
Very interesting; thanks for testing. It does sound like maybe the same underlying thing is happening, but on Wayland it ends up in a better codepath that makes it able to self-repair.
Comment 9 Max Sloan 2024-12-20 21:45:06 UTC
Of course, no problem. Yeah, it's quite strange. If there's any other testing you'd like me to do to help figure things out let me know.
Comment 10 Nate Graham 2025-05-07 19:26:48 UTC

*** This bug has been marked as a duplicate of bug 496926 ***