Skip to content

Fix cache retry assert on ServerAddrSet#12972

Open
bneradt wants to merge 1 commit intoapache:masterfrom
bneradt:fix-12971
Open

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

Conversation

@bneradt
Copy link
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
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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Assertion failure in set_cache_prepare_write_action_for_new_request on TSHttpTxnServerAddrSet retry

3 participants