Skip to content

Reuse prepared cache write on redirected request#11542

Merged
JosiahWI merged 2 commits intoapache:masterfrom
JosiahWI:fix/repro-lock-hang
Jul 23, 2024
Merged

Reuse prepared cache write on redirected request#11542
JosiahWI merged 2 commits intoapache:masterfrom
JosiahWI:fix/repro-lock-hang

Conversation

@JosiahWI
Copy link
Copy Markdown
Contributor

@JosiahWI JosiahWI commented Jul 12, 2024

Fixes #9275.

When there is no parent proxy and ATS is following a redirect, it will do
a cache lookup on the redirected request. If that lookup results in a cache
miss, it will start to prepare a new cache write, which is wrong. The state
machine intentionally leaves the write open so we can re-use the connection;
this is possible to ascertain from the code and from comments to that effect.

We should only open a new write if we don't already have one, when following
a redirect.

@JosiahWI JosiahWI self-assigned this Jul 12, 2024
Comment thread tests/gold_tests/redirect/redirect_to_same_origin_on_cache.test.py Outdated
@JosiahWI JosiahWI force-pushed the fix/repro-lock-hang branch from 5bedf90 to 50ee499 Compare July 15, 2024 12:57
@JosiahWI JosiahWI changed the title Mitigate cache connection failure after redirect Reuse prepared cache write on redirected request Jul 15, 2024
@JosiahWI JosiahWI force-pushed the fix/repro-lock-hang branch 2 times, most recently from 56fe317 to 938ae15 Compare July 15, 2024 13:36
Comment thread src/proxy/http/HttpSM.cc
@JosiahWI JosiahWI modified the milestones: 10.0.0, 10.1.0 Jul 15, 2024
JosiahWI added 2 commits July 15, 2024 08:53
This reproduces a variant of apache#9275 where we fail on the cache lookup. If
the cache lookup were to succeed, it should also fail on the cache write,
so this one test should cover both bugs.
Fixes apache#9275.

When there is no parent proxy and ATS is following a redirect, it will do
a cache lookup on the redirected request. If that lookup results in a cache
miss, it will start to prepare a new cache write, which is wrong. The state
machine intentionally leaves the write open so we can re-use the connection;
this is possible to ascertain from the code and from comments to that effect.

We should only open a new write if we don't already have one, when following
a redirect.
@JosiahWI JosiahWI force-pushed the fix/repro-lock-hang branch from 938ae15 to ce09429 Compare July 15, 2024 13:53
@JosiahWI JosiahWI marked this pull request as ready for review July 15, 2024 13:54
@JosiahWI JosiahWI requested a review from vmamidi July 15, 2024 16:04
@JosiahWI JosiahWI merged commit 875463c into apache:master Jul 23, 2024
@JosiahWI JosiahWI deleted the fix/repro-lock-hang branch July 23, 2024 16:38
@cmcfarlen cmcfarlen modified the milestones: 10.1.0, 10.0.0 Jul 26, 2024
@cmcfarlen
Copy link
Copy Markdown
Contributor

Cherry-picked to v10.0.x

cmcfarlen pushed a commit that referenced this pull request Jul 26, 2024
* Add AuTest to reproduce #9275

This reproduces a variant of #9275 where we fail on the cache lookup. If
the cache lookup were to succeed, it should also fail on the cache write,
so this one test should cover both bugs.

* Reuse prepared cache write on redirected request

Fixes #9275.

When there is no parent proxy and ATS is following a redirect, it will do
a cache lookup on the redirected request. If that lookup results in a cache
miss, it will start to prepare a new cache write, which is wrong. The state
machine intentionally leaves the write open so we can re-use the connection;
this is possible to ascertain from the code and from comments to that effect.

We should only open a new write if we don't already have one when following
a redirect.

(cherry picked from commit 875463c)
JosiahWI added a commit to JosiahWI/trafficserver that referenced this pull request Aug 16, 2024
JosiahWI added a commit to JosiahWI/trafficserver that referenced this pull request Aug 16, 2024
JosiahWI added a commit that referenced this pull request Aug 16, 2024
bneradt pushed a commit to bneradt/trafficserver that referenced this pull request Apr 15, 2025
…" (apache#11706) (apache#1044)

This reverts commit 6d55a20.

(cherry picked from commit 78b930e)

Co-authored-by: JosiahWI <41302989+JosiahWI@users.noreply.github.com>
bneradt added a commit to bneradt/trafficserver that referenced this pull request Aug 6, 2025
@bryancall
Copy link
Copy Markdown
Contributor

We need to close issue #10955 after cherry picking this PR to the 9.2.x branch.

ezelkow1 pushed a commit to ezelkow1/trafficserver that referenced this pull request Oct 13, 2025
* Add AuTest to reproduce apache#9275

This reproduces a variant of apache#9275 where we fail on the cache lookup. If
the cache lookup were to succeed, it should also fail on the cache write,
so this one test should cover both bugs.

* Reuse prepared cache write on redirected request

Fixes apache#9275.

When there is no parent proxy and ATS is following a redirect, it will do
a cache lookup on the redirected request. If that lookup results in a cache
miss, it will start to prepare a new cache write, which is wrong. The state
machine intentionally leaves the write open so we can re-use the connection;
this is possible to ascertain from the code and from comments to that effect.

We should only open a new write if we don't already have one when following
a redirect.

(cherry picked from commit 875463c)
@ezelkow1 ezelkow1 moved this from In progress to For Review in 9.2.x Branch and Release Oct 13, 2025
ezelkow1 added a commit that referenced this pull request Oct 14, 2025
* Add AuTest to reproduce #9275

This reproduces a variant of #9275 where we fail on the cache lookup. If
the cache lookup were to succeed, it should also fail on the cache write,
so this one test should cover both bugs.

* Reuse prepared cache write on redirected request

Fixes #9275.

When there is no parent proxy and ATS is following a redirect, it will do
a cache lookup on the redirected request. If that lookup results in a cache
miss, it will start to prepare a new cache write, which is wrong. The state
machine intentionally leaves the write open so we can re-use the connection;
this is possible to ascertain from the code and from comments to that effect.

We should only open a new write if we don't already have one when following
a redirect.

(cherry picked from commit 875463c)

Co-authored-by: JosiahWI <41302989+JosiahWI@users.noreply.github.com>
@ezelkow1 ezelkow1 moved this from For Review to Done for v9.2.x in 9.2.x Branch and Release Oct 14, 2025
bneradt pushed a commit to bneradt/trafficserver that referenced this pull request Jan 23, 2026
…he#1120)

* Add AuTest to reproduce apache#9275

This reproduces a variant of apache#9275 where we fail on the cache lookup. If
the cache lookup were to succeed, it should also fail on the cache write,
so this one test should cover both bugs.

* Reuse prepared cache write on redirected request

Fixes apache#9275.

When there is no parent proxy and ATS is following a redirect, it will do
a cache lookup on the redirected request. If that lookup results in a cache
miss, it will start to prepare a new cache write, which is wrong. The state
machine intentionally leaves the write open so we can re-use the connection;
this is possible to ascertain from the code and from comments to that effect.

We should only open a new write if we don't already have one when following
a redirect.

(cherry picked from commit 875463c)

Co-authored-by: JosiahWI <41302989+JosiahWI@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project
Status: picked-10.0.0

Development

Successfully merging this pull request may close these issues.

cache write lock not released when following redirect and no parent

5 participants