aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Gumport <[email protected]>2024-08-27 00:31:53 -0700
committerEdward Wang <[email protected]>2024-09-06 13:43:53 -0700
commit5e3e774a8d7681f52e9d02bf74e32a0f6031a4c7 (patch)
tree1ff19c557b8ee5f4cf074ec09c7810e261f0de81
parent4446912080ce84063e2da458a0c507b466db3825 (diff)
downloadpingora-5e3e774a8d7681f52e9d02bf74e32a0f6031a4c7.tar.gz
pingora-5e3e774a8d7681f52e9d02bf74e32a0f6031a4c7.zip
disable caching during error handling
This has the effect of reducing a warning log since we are not leaving the lock dangling for the next reader.
-rw-r--r--.bleep2
-rw-r--r--pingora-proxy/src/lib.rs2
-rw-r--r--pingora-proxy/tests/test_upstream.rs3
3 files changed, 3 insertions, 4 deletions
diff --git a/.bleep b/.bleep
index 59c1785..0f44214 100644
--- a/.bleep
+++ b/.bleep
@@ -1 +1 @@
-b0ee94e1ce384cb2d23a40bf6c7a4b7e32541412 \ No newline at end of file
+30c624970d46b07efd110fcfb8dd0b6f9a099e2b \ No newline at end of file
diff --git a/pingora-proxy/src/lib.rs b/pingora-proxy/src/lib.rs
index f872d82..890af98 100644
--- a/pingora-proxy/src/lib.rs
+++ b/pingora-proxy/src/lib.rs
@@ -607,6 +607,8 @@ impl<SV> HttpProxy<SV> {
};
if let Some(e) = final_error.as_ref() {
+ // If we have errored and are still holding a cache lock, release it.
+ session.cache.disable(NoCacheReason::InternalError);
let status = self.inner.fail_to_proxy(&mut session, e, &mut ctx).await;
// final error will have > 0 status unless downstream connection is dead
diff --git a/pingora-proxy/tests/test_upstream.rs b/pingora-proxy/tests/test_upstream.rs
index c2499f5..02174c1 100644
--- a/pingora-proxy/tests/test_upstream.rs
+++ b/pingora-proxy/tests/test_upstream.rs
@@ -1077,9 +1077,6 @@ mod test_cache {
init();
let url = "http://127.0.0.1:6148/sleep/test_cache_lock_network_error.txt";
- // FIXME: Dangling lock happens in this test because the first request aborted without
- // properly release the lock. This is a bug
-
let task1 = tokio::spawn(async move {
let res = reqwest::Client::new()
.get(url)