Directory listing cache expiry changes when the system clock jumps
Maintainers usually reply within 1 day
@Dodothereal is already working on this.
Since Oct 29, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 67/100
Research direction
Start in fsspec/dircache.py, where directory listing expiry is implemented, and trace how the configured lifetime is checked during lookup and iteration. Use the controlled-clock reproduction in the issue to verify both forward and backward wall-clock jumps. Done means a fresh listing remains cached after one elapsed second and an old listing expires after six seconds for a five-second lifetime.
Written by the indexing model from the issue text.
Description
Directory listing expiry uses the system clock even though the configured lifetime is an elapsed duration. A forward clock adjustment can expire a fresh listing, and a backward adjustment can keep an old listing alive beyond its lifetime.
Reproduced against master at a46dfd712fbbdb1d032c912ce028a5a1a4b667b0 using controlled clocks without changing the machine clock.
from types import SimpleNamespace
from unittest.mock import patch
from fsspec.dircache import DirCache
for elapsed, wall_jump in [(1, 1000), (6, -1000)]:
clock = {"wall": 10000, "elapsed": 0}
fake_time = SimpleNamespace(
time=lambda: clock["wall"],
monotonic=lambda: clock["elapsed"],
)
with patch("fsspec.dircache.time", fake_time):
cache = DirCache(listings_expiry_time=5)
cache["directory"] = []
clock["wall"] += elapsed + wall_jump
clock["elapsed"] += elapsed
print(f"{elapsed=} {wall_jump=} cached={'directory' in cache}")
For the five-second lifetime, the first case should remain cached after one elapsed second, and the second should expire after six. The current results are False and True respectively, rather than True and False. This also affects lookup and iteration.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 570
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 102
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fsspec/filesystem_spec
-
DBFS append mode silently overwrites existing filesPossibly taken @IlyaKhalafi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
fsspec/filesystem_spec#2429 ·
Maintainers usually reply within 1 day
-
DirCache.items() and values() raise RuntimeError with bounded LRU cachingPossibly taken @Junaid-006 claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
fsspec/filesystem_spec#2419 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
fsspec/filesystem_spec#2215 · 5 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
fsspec/filesystem_spec#1731 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
fsspec/filesystem_spec#171 · 4 comments ·
Maintainers usually reply within 1 day
All issues in fsspec/filesystem_spec
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
autowarefoundation/autoware_carla_scenario#1485 ·
Maintainers usually reply within 1 day
-
needs-area-label
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Official-Space-AI/OpenPhysGraspGen#114 ·
Maintainers usually reply within 2 days
-
changelog investigate
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ramnes/notion-sdk-py#441 ·
-
copy_tree splits same-file errors into charactersPossibly taken @Gambit-Checkmate claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 14 days