Bug 487395 - Plasmashell freezes when taking screenshot
Summary: Plasmashell freezes when taking screenshot
Status: REPORTED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-performance (show other bugs)
Version: 6.0.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-22 21:51 UTC by Hegyi László
Modified: 2024-07-11 23:18 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Flamegraph of plasmashell when the problem occurs (48.89 KB, image/svg+xml)
2024-05-22 21:51 UTC, Hegyi László
Details
Compressed perf data, its source is plasmashell when the problem happens (1.83 MB, application/gzip)
2024-05-22 21:52 UTC, Hegyi László
Details
Backtrace when the problem occurs (32.26 KB, text/plain)
2024-05-22 21:53 UTC, Hegyi László
Details
Screenshot of Spectacle's settings window (83.64 KB, image/png)
2024-05-22 21:54 UTC, Hegyi László
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hegyi László 2024-05-22 21:51:31 UTC
Created attachment 169720 [details]
Flamegraph of plasmashell when the problem occurs

SUMMARY
Plasmashell occosonaly freezes for over a minute when taking a screenshot

STEPS TO REPRODUCE
1.  Take a screenshot with PrintScreen button
2. Move spectacle's window around, maybe switch window focus a few times
3. Press printscreen again
4. Repeat above until freeze happens

OBSERVED RESULT

Freeze for over a minute

EXPECTED RESULT

No freeze

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20240512
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.0
Kernel Version: 6.8.8-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD Ryzen 5 2400G with Radeon Vega Graphics
Memory: 23,4 GiB of RAM
Graphics Processor: AMD Radeon RX 570 Series

ADDITIONAL INFORMATION
Attached flamegraph of running plasmashell, gdb backtrace and compressed perf data
Also attached screenshot of settings
Comment 1 Hegyi László 2024-05-22 21:52:06 UTC
Created attachment 169721 [details]
Compressed perf data, its source is plasmashell when the problem happens
Comment 2 Hegyi László 2024-05-22 21:53:32 UTC
Created attachment 169722 [details]
Backtrace when the problem occurs
Comment 3 Hegyi László 2024-05-22 21:54:10 UTC
Created attachment 169723 [details]
Screenshot of Spectacle's settings window
Comment 4 Hegyi László 2024-05-22 21:54:35 UTC
Forgot to mention, when this happens plasmashell uses 100% cpu
Comment 5 Hegyi László 2024-05-31 21:34:24 UTC
I done some further digging around, seems to be not just when taking screenshots, but also happen at other clipboard accesses.
Some more notes: I have clipboard history enabled, and the history size set ton 999 elements (the max what it would let me)
I also take many screenshots, so my history is pretty full of images (maybe around 60%)

Is it posible that Klipper re-saves every image at every clipboard modification?
Comment 6 Nate Graham 2024-06-12 14:40:35 UTC
Does the issue go away if you switch history to the default size of 20? If that's too disruptive since it would delete your history, feel free to try with a new clean user account.
Comment 7 Bug Janitor Service 2024-06-27 03:47:51 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Hegyi László 2024-07-11 23:18:03 UTC
Hi!

Sorry for the delay, didn't have time until now to perform some measurements, but here they are.

Steps to reproduce:

Create these two scripts:

#notify-until-success.sh

#!/bin/bash
notify-send "First"
while [ $? -ne 0 ]; do
    notify-send "Retry"
done

#screenshoot.sh

#!/bin/bash
for i in {1..1000}
do
   echo "$i"
   spectacle -b -c
done


Set your clipboard history size to 999

Run screenshoot.sh (note: this will destroy your clipboard history)
This will fill your clipboard history with screenshots, maybe play a video, so the encoding times will take a bit longer

Start spectacle, set it up in a way that it takes a screenshot at startup, then copies it the clipboard
Keep spectacle running, open a new shell (so the time command only meassures the blockage time of plasmashell coming back, without manual closing of spectacle)

Run the following command:
time  sh -c "spectacle && sleep 0.5 && ./notify-until-success.sh"

This takes a screenshot, and since plasmashell is completly blocked while this happens, notify send will only return when the tray is responsive again.

Decrease clipboard history size according to your taste, time it takes to run this will decrase
I have done this for a few datapoints, here they are:
999	0:03:47
950	0:03:32
700	0:02:13
500	0:01:54
250	0:00:50
150	0:00:28
125	0:00:15
75	0:00:01

Time is in Hour:Minute:Seconds