Bug 444904

Summary: Plasma sometimes crashes in DataControlDeviceManager::~DataControlDeviceManager() when dragging Firefox tab on Wayland
Product: [Plasma] plasmashell Reporter: Shubham Arora <shubhamarora>
Component: generic-crashAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED DUPLICATE    
Severity: crash CC: kde, nate, philipp.reichmuth, shubhamarora
Priority: NOR Keywords: wayland
Version: master   
Target Milestone: 1.0   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Plasmashell crash
Backtrace plasmashell fedora 35
Firefox console Error

Description Shubham Arora 2021-11-03 19:42:06 UTC
Created attachment 143180 [details]
Plasmashell crash

SUMMARY
Unrecoverable plasma shell crash on dragging firefox tab in wayland.

STEPS TO REPRODUCE
1. Open firefox on wayland session with multiple tabs.
2. Drag one of the tab out of window on desktop to create a new window.

OBSERVED RESULT
1. Plasma shell crashes.
2. running plasmashell --replace from krunner has no affect.
3. Context menu and Panel are not accessible.
4. Clock widget is still accessible.
5. Krunner will start opening after some interval automatically. Closing it with Esc make it open again after sometime.
6. Sometimes entire screen will go black. Firefox will still be accessible.  running plasmashell --replace bring wallpaper and clock widget back but not panel and context menu.
7. Crash is observed 90% of the time. Normal session only resolved with a logout or restart.
8. Sometimes krunner starts in top left corner

EXPECTED RESULT
No Crash

Operating System: Manjaro Linux
KDE Plasma Version: 5.23.80
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.15.0-2-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: Radeon RX 580 Series

ADDITIONAL INFORMATION
I would like to provide back trace. Guidance needed on how to do it on arch based system.
Comment 1 Shubham Arora 2021-11-04 10:40:52 UTC
Some Additional Information:
1. Using firefox nightly from officially provided tar.gz
2. Also tried to reproduce the crash after refreshing firefox, with following observations:
    - Crash is no longer unrecoverable on a fresh install of firefox. The panel always comes back.
    - enabling gfx.webrender.all crashes the firefox after 1 or 2 tries of dragging the tab
    - enabling layers.acceleration.force-enabled increases the chances of crashing on 1st try.
3. Sometimes logout doesn't resolve the issue. Full reboot is required.
Comment 2 Nate Graham 2021-11-08 19:13:02 UTC
Can you please attach a backtrace of the crash? See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
Comment 3 Shubham Arora 2021-11-12 20:06:18 UTC
Created attachment 143500 [details]
Backtrace plasmashell fedora 35
Comment 4 Shubham Arora 2021-11-12 20:11:09 UTC
Was able to reproduce the issue on fresh install of fedora 35. Let me know if anything is still missing.  It was difficult to reproduce the crash on with gdb for some reason. Steps and Observed results still the same. Also observed Timeout reading from pipe error on moving firefiox tab in console. Attaching image for the same.

Operating System: Fedora Linux 35
KDE Plasma Version: 5.23.2
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
Kernel Version: 5.14.17-301.fc35.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: Radeon RX 580 Series
Comment 5 Shubham Arora 2021-11-12 20:11:40 UTC
Created attachment 143501 [details]
Firefox console Error
Comment 6 phrxmd 2021-11-13 15:21:12 UTC
As described, it works for me - i.e. I can drag a tab from Firefox 93 to the desktop to create a new window, and Plasma 5.23.2 doesn't crash.

However, when I set "layers.acceleration.force-enabled" to "true", dragging a tab to the desktop will no longer create a new window.
Comment 7 Shubham Arora 2021-11-14 12:00:28 UTC
(In reply to Philipp Reichmuth from comment #6)
> As described, it works for me - i.e. I can drag a tab from Firefox 93 to the
> desktop to create a new window, and Plasma 5.23.2 doesn't crash.
> 
> However, when I set "layers.acceleration.force-enabled" to "true", dragging
> a tab to the desktop will no longer create a new window.

Try enabling gfx.webrender.all as well. Make sure Fission is enabled and web gpu from about:preferences#experimental . 

My point is whatever the settings, plasma shell should not crash especially on Wayland. It is better reproducible on arch. On stable fedora it might take a couple of tries.

Additionally for some reason DrKonqi never appears.
Comment 8 phrxmd 2021-11-14 12:48:09 UTC
(In reply to Shubham Arora from comment #7)
> Try enabling gfx.webrender.all as well. Make sure Fission is enabled and web
> gpu from about:preferences#experimental . 

So I've enabled gfx.webrender.all, fission.autostart and dom.webgpu.enabled, restarted Firefox and dragged about 20 tabs from different websites to my desktop without a crash.

This is on OpenSUSE Tumbleweed with the MozillaFirefox package 93.0-80.3 from the home:trmdi:Tumbleweed repo (because it has the global menu patch), with KDE Wayland 5.23.2.

I'm not saying that this issue doesn't happen, only that I can't reproduce it yet. If/when it happens, I will post again here. Either way it should not bring down Plasmashell.
Comment 9 David Edmundson 2022-01-12 16:07:46 UTC
Pasting inline:

#1  0x00007fff04384c85 in zwlr_data_control_manager_v1_destroy (zwlr_data_control_manager_v1=0x0) at /usr/src/debug/plasma-workspace-5.23.2-1.fc35.x86_64/redhat-linux-build/klipper/systemclipboard/wayland-wlr-data-control-unstable-v1-client-protocol.h:238
No locals.
#2  QtWayland::zwlr_data_control_manager_v1::destroy (this=0x555556b3f290) at /usr/src/debug/plasma-workspace-5.23.2-1.fc35.x86_64/redhat-linux-build/klipper/systemclipboard/qwayland-wlr-data-control-unstable-v1.cpp:83
No locals.
#3  DataControlDeviceManager::~DataControlDeviceManager (this=<optimized out>, this=<optimized out>) at /usr/src/debug/plasma-workspace-5.23.2-1.fc35.x86_64/klipper/systemclipboard/waylandclipboard.cpp:42
No locals.
#4  DataControlDeviceManager::~DataControlDeviceManager (this=<optimized out>, this=<optimized out>) at /usr/src/debug/plasma-workspace-5.23.2-1.fc35.x86_64/klipper/systemclipboard/waylandclipboard.cpp:43
No locals.
#5  std::default_delete<DataControlDeviceManager>::operator() (__ptr=0x555556b3f280, this=<optimized out>) at /usr/include/c++/11/bits/unique_ptr.h:85
No locals.
#6  std::unique_ptr<DataControlDeviceManager, std::default_delete<DataControlDeviceManager> >::~unique_ptr (this=<optimized out>, this=<optimized out>) at /usr/include/c++/11/bits/unique_ptr.h:361
Comment 10 David Edmundson 2022-01-14 16:17:34 UTC

*** This bug has been marked as a duplicate of bug 429267 ***
Comment 11 David Edmundson 2022-01-14 16:18:50 UTC
Edit, maybe not quite a duplicate, but in any case the new version of this code has a guard round this and should be fixed in 5.24