Configured FolderList instances share folders and misalign refresh timers
Author: xu91102Created Sep 26, 2026Updated Sep 26, 2026
Labelsneeds more info
Describe the bug
Two configured FolderList instances share the same class-level list. Creating the second instance appends its folders to the first instance as well. Each instance still has only its own timers, so the folder entries and refresh timers can also stop matching.
Reproduction
On develop b3f1cf008e9ad28eb02e1bb63d74f980683fedf6, make two config files:
# first.conf
[folders]
folder_1_path=/first
folder_1_refresh=600# second.conf
[folders]
folder_1_path=/second
folder_1_refresh=60from glances.config import Config
from glances.folder_list import FolderList
first = FolderList(Config(config_dir='first.conf'))
second = FolderList(Config(config_dir='second.conf'))
print([folder['path'] for folder in first.get()])
# ['/first', '/second'] -- expected ['/first']
print([folder['path'] for folder in second.get()])
# ['/first', '/second'] -- expected ['/second']The existing refresh tests reset the private class-level list between tests, which masks this state leak between instances. Initializing the list in the constructor removes that need.
Environment
Glances 4.5.8.dev1, Python 3.12.13/macOS. Reproduced with real configuration files and the public FolderList constructor/getters. No directory scanning is needed to trigger it.
Source: nicolargo/glances