Skip to content

tests: avoid stale test file parts on retries - #22319

Closed
GrahamCampbell wants to merge 2 commits into
curl:masterfrom
GrahamCampbell:tests-retry-reload
Closed

tests: avoid stale test file parts on retries#22319
GrahamCampbell wants to merge 2 commits into
curl:masterfrom
GrahamCampbell:tests-retry-reload

Conversation

@GrahamCampbell

@GrahamCampbell GrahamCampbell commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

getpart and getpartattr results are memoized keyed on section, part and filename (2039253). When a test is retried, singletest_preprocess regenerates the preprocessed file with fresh variable substitutions, such as a new server port, but the stale cached parts keep being returned, so retries reuse the old port and --retry cannot recover. One flaky hit of test 798 (the root cause of which I fixed in #22318) thus became five identical failures and a red job.

This PR adjusts loadtest to flush the memoized caches whenever it actually reads a file, and singletest_preprocess to force the reload past the already-loaded check. Repeated same-file calls still return early with a warm cache.

The same staleness also exists in ftpserver.pl, which holds its own copy of these caches in a long lived process and leans on the already-loaded check in every command handler. A retry landing on the same runner would keep serving the previous attempt's file, and that predates the memoization since the check also keeps the old file contents. The server now forces a reload whenever a client connects, while lookups within a connection stay warm.

@github-actions github-actions Bot added the tests label Jul 14, 2026
@dfandrich

Copy link
Copy Markdown
Contributor

Good catch! Not just the memoized output but the cached xml file would be affected, as you've identified. I need to think for a moment if this solution is sufficient in the case of parallel tests.

@dfandrich dfandrich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see parallel tests affecting this. The selection of servers is done in the runner as is the variable substitution, so the effects should be contained within the runner process. This looks like a good solution to this.

Comment thread tests/runner.pm Outdated
@GrahamCampbell GrahamCampbell changed the title runtests: flush cached test parts when (re)loading a file tests: avoid stale test file parts on retries Jul 15, 2026
@GrahamCampbell
GrahamCampbell requested a review from dfandrich July 15, 2026 21:08
@GrahamCampbell
GrahamCampbell marked this pull request as ready for review July 15, 2026 21:08
@dfandrich dfandrich closed this in d0545d2 Jul 15, 2026
@GrahamCampbell
GrahamCampbell deleted the tests-retry-reload branch July 16, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants