Skip to content

Fix cache_read_vc assertion crash in redirect flow#13089

Merged
bneradt merged 1 commit intoapache:masterfrom
bneradt:cache-open-read-crash-fix
Apr 15, 2026
Merged

Fix cache_read_vc assertion crash in redirect flow#13089
bneradt merged 1 commit intoapache:masterfrom
bneradt:cache-open-read-crash-fix

Conversation

@bneradt
Copy link
Copy Markdown
Contributor

@bneradt bneradt commented Apr 14, 2026

This builds on top of #12182

This fixes a crash seen in docs where the assertion at
HttpCacheSM.cc:137 fails:

  ink_assert((cache_read_vc == nullptr) ||
             master_sm->t_state.redirect_info.redirect_in_process)

The crash occurs when a redirect cache lookup completes after
redirect_in_process has been cleared, but cache_read_vc from the
original request is still set. The root cause is that reset() only
resets captive_action but does not close the existing cache_read_vc
or cancel any pending retry events.

This patch adds the missing cleanup to reset(): it now closes any
existing cache read VC and cancels pending retry events before
starting a new cache operation. This ensures stale state from a
previous cache operation cannot interfere with the new one.

This fixes a crash where the assertion at HttpCacheSM.cc:137 fails:

  ink_assert((cache_read_vc == nullptr) ||
             master_sm->t_state.redirect_info.redirect_in_process)

The crash occurs when a redirect cache lookup completes after
redirect_in_process has been cleared, but cache_read_vc from the
original request is still set. The root cause is that reset() only
resets captive_action but does not close the existing cache_read_vc
or cancel any pending retry events.

This patch adds the missing cleanup to reset(): it now closes any
existing cache read VC and cancels pending retry events before
starting a new cache operation. This ensures stale state from a
previous cache operation cannot interfere with the new one.
@bneradt bneradt added this to the 11.0.0 milestone Apr 14, 2026
@bneradt bneradt self-assigned this Apr 14, 2026
@bneradt bneradt requested a review from masaori335 April 14, 2026 22:50
Copy link
Copy Markdown
Contributor

@masaori335 masaori335 left a comment

Choose a reason for hiding this comment

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

Makes sense. Thank you!

Probably, this is what I missed with #12182 and observed a leak of openDirEntry, which is fixed by #12205.

@masaori335
Copy link
Copy Markdown
Contributor

[approve ci]

@bneradt bneradt merged commit 9089a5c into apache:master Apr 15, 2026
15 checks passed
@bneradt bneradt deleted the cache-open-read-crash-fix branch April 15, 2026 18:20
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x Apr 15, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Apr 15, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 Apr 15, 2026
@cmcfarlen
Copy link
Copy Markdown
Contributor

Cherry-picked to 10.2.x

cmcfarlen pushed a commit that referenced this pull request Apr 15, 2026
This fixes a crash where the assertion at HttpCacheSM.cc:137 fails:

  ink_assert((cache_read_vc == nullptr) ||
             master_sm->t_state.redirect_info.redirect_in_process)

The crash occurs when a redirect cache lookup completes after
redirect_in_process has been cleared, but cache_read_vc from the
original request is still set. The root cause is that reset() only
resets captive_action but does not close the existing cache_read_vc
or cancel any pending retry events.

This patch adds the missing cleanup to reset(): it now closes any
existing cache read VC and cancels pending retry events before
starting a new cache operation. This ensures stale state from a
previous cache operation cannot interfere with the new one.

(cherry picked from commit 9089a5c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

3 participants