Skip to content

Commit d2825e7

Browse files
authored
Add is_stopping check around critical macro in walreceiver (#11496)
The timeline stopping state is set much earlier than the cancellation token is fired, so by checking for the stopping state, we can prevent races with timeline shutdown where we issue a cancellation error but the cancellation token hasn't been fired yet. Fix #11427.
1 parent a6ff8ec commit d2825e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ pub(super) async fn handle_walreceiver_connection(
445445
.inspect_err(|err| {
446446
// TODO: we can't differentiate cancellation errors with
447447
// anyhow::Error, so just ignore it if we're cancelled.
448-
if !cancellation.is_cancelled() {
448+
if !cancellation.is_cancelled() && !timeline.is_stopping() {
449449
critical!("{err:?}")
450450
}
451451
})?;
@@ -577,7 +577,7 @@ pub(super) async fn handle_walreceiver_connection(
577577
.inspect_err(|err| {
578578
// TODO: we can't differentiate cancellation errors with
579579
// anyhow::Error, so just ignore it if we're cancelled.
580-
if !cancellation.is_cancelled() {
580+
if !cancellation.is_cancelled() && !timeline.is_stopping() {
581581
critical!("{err:?}")
582582
}
583583
})?;

0 commit comments

Comments
 (0)