Skip to content

Fix cache retry assert on ServerAddrSet#12972

Merged
bneradt merged 1 commit intoapache:masterfrom
bneradt:fix-12971
Mar 16, 2026
Merged

Fix cache retry assert on ServerAddrSet#12972
bneradt merged 1 commit intoapache:masterfrom
bneradt:fix-12971

Conversation

@bneradt
Copy link
Copy Markdown
Contributor

@bneradt bneradt commented Mar 13, 2026

A TSHttpTxnServerAddrSet retry can re-enter the cache miss path after ATS already holds a cache write lock for the same request. The redirect-only prepared-write reuse logic then asserts because this is not actually a redirect.

Preserve the existing cache write lock and retry context when the retry returns through HandleCacheOpenReadMiss. Add an autest that fails on the unpatched code with the redirect_in_process assertion and passes with this fix.

Fixes: #12971

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an ATS crash/assertion when a TSHttpTxnServerAddrSet()-driven origin retry re-enters the cache-miss path while the transaction already holds a cache write lock, and adds an integration test to cover the cached retry case (issue #12971).

Changes:

  • Preserve an existing cache write lock when re-entering HandleCacheOpenReadMiss() during origin retry.
  • Extend the existing TSHttpTxnServerAddrSet retry gold test to run both with cache disabled and enabled, and assert no abort/assert output in the cached run.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/proxy/http/HttpTransact.cc Avoids re-preparing cache writes (and the redirect-only assert path) when a retry re-enters cache-miss handling with an existing write lock.
tests/gold_tests/pluginTest/tsapi/test_TSHttpTxnServerAddrSet_retry.test.py Adds a second test run with enable_cache=True and validates ATS does not abort/assert during the retry flow.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tests/gold_tests/pluginTest/tsapi/test_TSHttpTxnServerAddrSet_retry.test.py Outdated
bryancall
bryancall previously approved these changes Mar 13, 2026
A TSHttpTxnServerAddrSet retry can re-enter the cache miss path after
ATS already holds a cache write lock for the same request. The
redirect-only prepared-write reuse logic then asserts because this is
not actually a redirect.

Preserve the existing cache write lock and retry context when the
retry returns through HandleCacheOpenReadMiss. Add an autest that
fails on the unpatched code with the redirect_in_process assertion and
passes with this fix.

Fixes: apache#12971
@bneradt bneradt merged commit bf909ed into apache:master Mar 16, 2026
15 checks passed
@bneradt bneradt deleted the fix-12971 branch March 16, 2026 15:46
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x Mar 16, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Mar 18, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 Mar 18, 2026
@cmcfarlen
Copy link
Copy Markdown
Contributor

Cherry-picked to 10.2.x

cmcfarlen pushed a commit that referenced this pull request Mar 18, 2026
A TSHttpTxnServerAddrSet retry can re-enter the cache miss path after
ATS already holds a cache write lock for the same request. The
redirect-only prepared-write reuse logic then asserts because this is
not actually a redirect.

Preserve the existing cache write lock and retry context when the
retry returns through HandleCacheOpenReadMiss. Add an autest that
fails on the unpatched code with the redirect_in_process assertion and
passes with this fix.

Fixes: #12971
(cherry picked from commit bf909ed)
@github-project-automation github-project-automation Bot moved this to For v10.1.1 in ATS v10.1.x May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: For v10.1.1
Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

Assertion failure in set_cache_prepare_write_action_for_new_request on TSHttpTxnServerAddrSet retry

4 participants