Skip to content

admission: ensure GetPebbleMetrics is not called after StoreGrantCoor… #146301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/util/admission/grant_coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ func (sgc *StoreGrantCoordinators) TryGetSnapshotQueueForStore(storeID roachpb.S
func (sgc *StoreGrantCoordinators) close() {
// closeCh can be nil in tests that never called SetPebbleMetricsProvider.
if sgc.closeCh != nil {
// Ensure that the goroutine has observed the close and will no longer
// call GetPebbleMetrics, since the engines will be closed soon after this
// method returns, and calling GetPebbleMetrics on closed engines is not
// permitted.
sgc.closeCh <- struct{}{}
// Close the channel, so that if close gets called twice due to a bug,
// sending on the closed channel will panic instead of the send being
// blocked forever.
close(sgc.closeCh)
}

Expand Down
Loading