lazy.reload_config() method leaks CPU
See original GitHub issueEvery call to lazy.reload_config()
increases the average CPU usage by Qtile. It is quite a small increase, but it builds up rather quickly if you reload the config often, when testing new settings for example.
By doing a few calls to lazy.reload_config()
in succession, you can easily push up average CPU usage from around 1% to 8-10%…the CPU usage stays at that level, even if left for 20 minutes or more…quitting Qtile, and starting it with the same config, results in expected CPU usage of around 1%, even if left for 24 hours or more.
This is on Qtile version 0.20.0 running on ArchLinux (kernel 5.16.8) with xorg-server 21.1.3 and Python 3.10.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Petition to remove the /reload command | Page 4 | Bukkit Forums
Due to the way Java works, and how Bukkit implements it's classloaders, this causes a memory leak. This is easy to confirm with...
Read more >Upstart Intro, Cookbook and Best Practises - Ubuntu
Upstart is an event-based replacement for the /sbin/init daemon which handles starting of tasks and services during boot, stopping them during shutdown and ......
Read more >Chapter 7. Bug fixes Red Hat Enterprise Linux 8
Various bugs, including resource leaks, have been fixed. ... Previously, when using NetBackup as a backup method, ... smbcontrol all reload-config.
Read more >Red Hat Enterprise Linux 8.4 8.4 Release Notes
Fixed memory leaks and typos in the source code. ... Fixed false negatives in wait_for_all_occ_init() of occ command.
Read more >Change logs for linux-lowlatency source package in Precise
LP: #1369711 * sparc64: Fix huge TSB mapping on pre-UltraSPARC-III cpus. ... S: wrong instructions 3.2 arch/score/kernel/process.c : just some typos - LP: ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@elParaguayo - I just did a test and I can confirm that it fixes the problem.
Great work and many thanks !
OK. I’ve actually got a pretty good idea of what’s causing this. The clue was in you saying you’ve got multiple instances.
Basically, when we reload the config we finalize currently running widgets. We do this by iterating over a dictionary of widgets where the key is the widget name. The name defaults to the widget class name. This means that, if you use multiple instances of a widget class, there’s only going to be one instance of that widget in the map. The rest will therefore not be finalized and their timers will carry on running.
#3010 should therefore solve this issue. I’ll take another look at that PR and see if we can get it in a good form for you to test.
If not, I can knock out a quicker fix for this particular issue.