Skip to content

test(local-files): hold the main-context lock while a stamp test relies on the real clock - #2703

Merged
l0gicgate merged 1 commit into
mainfrom
test/2617-stamp-test-holds-the-clock-lock
Nov 24, 2026
Merged

l0gicgate merged 1 commit into
mainfrom
test/2617-stamp-test-holds-the-clock-lock

Conversation

@JoeJoeflyn

Copy link
Copy Markdown
Collaborator

Description

adapters::local_files::tests::stamps::a_check_sees_a_change_the_attribute_cache_hides failed whenever a local_operations test moved the process-wide test clock (TEST_NOW) beside it. The simulated NFS attribute cache dates its entries with that clock, so its 30 s entry looked expired and the "plain stat" returned fresh times.

Every test that moves the clock already holds the shared main-context lock while it does (28 tests, all take it before setting the clock). The stamp test took that lock only inside its helpers, so it now holds it for its whole run. The helpers gained variants that take the held guard instead of locking again; nothing outside these two test files changes.

Here the issue's command failed 5 of 5 runs before the change and passed 8 of 8 after it. The issue was found on h5-integration, where these two files are identical to main. scripts/code-health.sh was not run (no CodeScene token).

Visual evidence

N/A: test-only change.

How to test

  1. Run ./scripts/test-headless.py -- a_check_sees_a_change_the_attribute_cache_hides deletion::open_files file_copy.
  2. Repeat it several times.

Expected result: Every run passes; before this change most runs failed with "a plain stat answers from the cache".

Related issue

Closes #2617

…es on the real clock

a_check_sees_a_change_the_attribute_cache_hides failed whenever a
local_operations test moved the process-wide test clock beside it, because
the simulated attribute cache then looked expired. Those tests only move
the clock while they hold the shared main-context lock, so the stamp test
now holds it for its whole run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: stamps::a_check_sees_a_change_the_attribute_cache_hides races the global test clock

2 participants