Skip to content

Commit 7e9c9fc

Browse files
committed
admission: ensure GetPebbleMetrics is not called after StoreGrantCoordinators.close
Fixes #140454, #144172 Epic: none Release note: None
1 parent 42864a9 commit 7e9c9fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/util/admission/grant_coordinator.go

+5
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ func (sgc *StoreGrantCoordinators) TryGetSnapshotQueueForStore(storeID roachpb.S
276276
func (sgc *StoreGrantCoordinators) close() {
277277
// closeCh can be nil in tests that never called SetPebbleMetricsProvider.
278278
if sgc.closeCh != nil {
279+
// Ensure that the goroutine has observed the close and will no longer
280+
// call GetPebbleMetrics, since the engines will be closed soon after this
281+
// method returns, and calling GetPebbleMetrics on closed engines is not
282+
// permitted.
283+
sgc.closeCh <- struct{}{}
279284
close(sgc.closeCh)
280285
}
281286

0 commit comments

Comments
 (0)