Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stmtdiagnostics: fix possible race when polling is disabled
This commit fixes a possible race on `timeutil.Timer.C` that can happen when polling interval is disabled. In particular, the race would occur because disabling the polling `Stop`s the timer which puts it back into the pool which disallows further access to the `Timer` object. However, we already stored the reference to `Timer.C`, so we'd read from the channel which could be concurrently overwritten by another goroutine (that happened to pick up this timer object from the pool). To solve this race we now store the channel separately and explicitly nil it out after having stopped the timer (which makes it block forever, until the polling interval is changed). Additionally, this commit adds non-negative validation to the cluster setting since there is really no point in allowing negative durations for the polling interval. Release note: None
- Loading branch information