Repository navigation
Fix ATS crashes when reloading parent.config - #13858
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
What changed in this PR
Prevents ATS crashes when parent.config is reloaded by handling the case where no current server is selected before accessing server fields.
Changes:
- Adds a guard in
HandleCacheOpenReadHitto treat a missings->current.serveras a parent failure. - Avoids dereferencing
s->current.serverby callinghandle_parent_down(s)and returning early.
| File | Description |
|---|---|
src/proxy/http/HttpTransact.cc |
Adds a null-server guard to avoid dereference and route control flow to parent-down handling. |
Review effort: Lite
SummaryThe diagnosis is correct: with proxy.config.http.no_dns_just_forward_to_parent=1, find_server_and_update_current_info() can take the DIRECT branch, flip parent_result to FAIL and return HOST_NONE without setting s->current.request_to. HandleCacheOpenReadHit tests the member (request_to == HOST_NONE && result == FAIL), so its guard is skipped and build_request() runs with a null s->current.server. The added null check does stop the crash, but it treats the symptom one level down. It also bypasses the existing serve-stale logic, so a revalidation that could have returned the stale cached object now always returns a 502. Fixing the inconsistent exit in find_server_and_update_current_info() would let the existing guard handle this case, including serving stale when allowed. The Format CI job is also failing on the new lines. Critical Issues - Must Fix
|
|
@traeak |
traeak
left a comment
There was a problem hiding this comment.
Why this fixes the crash
- HandleCacheOpenReadHit (line 3025) checks that request_to is HOST_NONE and
the parent result is FAIL. On the crashing path both are now true, so that
check catches it. - From there it either serves the stale cached copy, if that's allowed, or
returns a 502. Either way it never reaches build_request() with a null
server. - The reporter's logs show the warning that is printed on exactly this branch,
so this is the path that crashed in production.
Other callers aren't affected
- DNS lookup of the parent failed (around line 1942): after a HOST_NONE
return, this code already asserts that request_to == HOST_NONE. Before this
change, debug builds would have tripped that assert on this path; now they
won't. - Response from the parent (around line 4008): the HOST_NONE case resets
request_to itself, so behavior there is unchanged. - LookupSkipOpenServer and the cache-miss path: they only look at the parent
result, so they're unaffected.
bryancall
left a comment
There was a problem hiding this comment.
✅ Approve
Solid fix, thanks for tracking it down.
Non-blocking: regression test
A stale revalidation through a go_direct=true rule, alongside tests/gold_tests/parent_proxy/replays/bypass_parent_no_dns.replay.yaml, would pin this. Fine as a follow-up.
* Fix ATS crashes when reloading parent.config --------- Co-authored-by: k-ishikawa <[email protected]> (cherry picked from commit 3796630)
* Fix ATS crashes when reloading parent.config --------- Co-authored-by: k-ishikawa <[email protected]> (cherry picked from commit 3796630)
|
Cherry-picked to the 10.2.x branch as v10.2.2 for the 10.2.2 release. |

Purpose
resolve issue #13496
What's New
The cause of issue #13496 is that
build_requestis called even thoughs->current.serveris null.Therefore, I have modified the code so that if
s->current.serverisnull,handle_parent_downis called and the function returns—thereby treating the communication as an error and preventingbuild_requestfrom being invoked.