This is an automated email from the ASF dual-hosted git repository.
ezelkow1 pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new 526ed6bb79 Fix cache retry assert on ServerAddrSet (#13396)
526ed6bb79 is described below
commit 526ed6bb79af5c8177567579d3d5289107e3b5e8
Author: Evan Zelkowitz <[email protected]>
AuthorDate: Thu Jul 16 12:19:20 2026 -0600
Fix cache retry assert on ServerAddrSet (#13396)
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 when the retry returns through
HandleCacheOpenReadMiss.
Backport of #12972 to 9.2.x. The accompanying autest is omitted because
its plugin infrastructure (#12733) is not present on 9.2.x; enum and
debug-macro names were adapted to the 9.2.x code.
Fixes: #12971
Co-authored-by: Evan Zelkowitz <[email protected]>
---
proxy/http/HttpTransact.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 7f9f07e854..88494e24f3 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3330,6 +3330,12 @@ HttpTransact::HandleCacheOpenReadMiss(State *s)
s->cache_info.action = CACHE_DO_NO_ACTION;
} else if (s->api_server_response_no_store) { // plugin may have decided not
to cache the response
s->cache_info.action = CACHE_DO_NO_ACTION;
+ } else if (s->cache_info.write_lock_state == CACHE_WL_SUCCESS &&
s->cache_info.action == CACHE_DO_WRITE) {
+ // Origin retry paths such as TSHttpTxnServerAddrSet() can loop back
through
+ // HandleCacheOpenReadMiss after we already own the cache write lock. This
+ // is still the same request, so keep the existing write lock instead of
+ // re-preparing a write as if this were a redirect or a new cache miss.
+ TxnDebug("http_trans", "Reusing existing cache write lock while retrying
origin selection");
} else {
HttpTransact::set_cache_prepare_write_action_for_new_request(s);
}