Bug 441910 - plasmashell re-reads zoneinfo file many times every second
Summary: plasmashell re-reads zoneinfo file many times every second
Status: RESOLVED UNMAINTAINED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-performance (other bugs)
Version First Reported In: 5.18.6
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: efficiency-and-performance
Depends on:
Blocks:
 
Reported: 2021-09-02 14:33 UTC by V
Modified: 2022-05-17 20:54 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description V 2021-09-02 14:33:35 UTC
SUMMARY

plasmashell process reads the /usr/share/zoneinfo/{MY_AREA}/{MY_CITY} file 20-40 times per second, which creates unnecessary extra load to the hard drive.

STEPS TO REPRODUCE

1. run: "sudo timeout 3s fatrace -p PID_OF_PLASMASHELL 2>&1 | grep R | wc -l" 
- see about 100 reads every 3 seconds (~30 per second)
2. run: "sudo timeout 3s strace -v -f -T -y -p PID_OF_PLASMASHELL 2>&1 | grep zoneinfo | grep 'read(' | grep ' = 0 ' | wc -l" 
- see about 120 reads every 3 seconds (~40 per second)

OBSERVED RESULT

strace logs are flooded with "read(46</usr/share/zoneinfo/{MY_AREA}/{MY_CITY}" lines.

EXPECTED RESULT

I think plasmashell should read this file only once when being started, and one more time if the current timezone is changed by the user.


SOFTWARE/OS VERSIONS

Linux/KDE Plasma: openSUSE Leap 15.2 distro
KDE Plasma Version: 5.18.6
KDE Frameworks Version: 5.71.0
Qt Version: 5.12.7

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2021-09-02 19:25:45 UTC
Thanks for the detailed steps to reproduce, but I don't see this on my own system.
Comment 2 V 2021-09-03 05:00:51 UTC
Okay I've nailed it down - it's a "Digital Clock" widget issue. 

Right-click the digital clock on the panel, then open "Configure Digital Clock..." and check the "Show seconds" checkbox, and then plasmashell will start to read the zoneinfo file 30-40 times every single second.



P.S. there is a wrong command in my first comment - in "fatrace -p PID_OF_PLASMASHELL" the "-p" option will _ignore_ the provided PID, so a right command is:

sudo timeout 3s fatrace 2>&1 | grep "($(pidof plasmashell))" | grep R | wc -l
Comment 3 Nate Graham 2021-09-03 14:24:21 UTC
Thanks. However I still cannot reproduce the issue when I enable "show seconds" in the Digital Clock.

Note that I am using Plasma 5.23 (git master) while you are using 5.18, which is quite old at this point. So there is a chance this has been fixed since then.
Comment 4 V 2022-05-15 08:26:47 UTC
I think I've nailed it down: I have multiple time zones set in the digital clock widget (to know which time it is in the different cities when I hover the mouse cursor above the digital clock). 
If I remove all time zones except the main one then the issue disappears.

STEPS TO REPRODUCE

1. right click on the widget -> Configure Digital Clock 
2. enable Appearance -> Show seconds
3. tick several time zones in Time Zones tab.
4. Apply, and run "sudo fatrace | grep $(pidof plasmashell)"
Comment 5 Nate Graham 2022-05-15 18:55:28 UTC
Interesting. Cannot reproduce with git master everything KDE on top of Fedora 36. Are you still using 5.18.6 with openSUSE Leap 15.2?
Comment 6 V 2022-05-15 19:35:25 UTC
(In reply to Nate Graham from comment #5)
> Interesting. Cannot reproduce with git master everything KDE on top of
> Fedora 36. Are you still using 5.18.6 with openSUSE Leap 15.2?

I have upgraded to openSUSE Leap 15.3 however the new distro version still has the same version of KDE.

Operating System: openSUSE Leap 15.3
KDE Plasma Version: 5.18.6
KDE Frameworks Version: 5.76.0
Qt Version: 5.12.7

Possibly they make some backports from the current version same as they do with the kernel, still I think that the reason of this bug is an old KDE version.
Comment 7 Nate Graham 2022-05-17 20:54:14 UTC
Yeah. I guess you would need to talk to them about it. Or just accept that experiencing old bugs is a consequence of using a "stable release" distro. :)