From 9b43204893900a890ef29f571a1e1a77e49d2e22 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Fri, 10 Jan 2025 20:21:01 +0100 Subject: [PATCH] fix(page_service): Timeline::gate held open while throttling (#10314) When we moved throttling up from Timeline::get into page_service, we stopped being sensitive to `Timeline::cancel`, even though we're holding a Handle and thus a guard on the `Timeline::gate` open. This PR rectifies the situation. Refs - Found while investigating #10309 (hung detach because gate kept open), but not expected to be the root cause of that issue because the affected tenants are not being throttled according to their metrics. --- pageserver/src/page_service.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pageserver/src/page_service.rs b/pageserver/src/page_service.rs index 0c4a1b18f5..f6504bd3b5 100644 --- a/pageserver/src/page_service.rs +++ b/pageserver/src/page_service.rs @@ -618,6 +618,9 @@ impl BatchedFeMessage { }; let throttled = tokio::select! { throttled = shard.pagestream_throttle.throttle(tokens) => { throttled } + _ = shard.cancel.cancelled() => { + return Err(QueryError::Shutdown); + } _ = cancel.cancelled() => { return Err(QueryError::Shutdown); }