Update comments on avoiding proxycfg deadlock

This commit is contained in:
freddygv 2021-02-08 09:45:45 -07:00
parent 0a8f2f2105
commit a417f88e44
1 changed files with 4 additions and 2 deletions

View File

@ -624,7 +624,7 @@ func (s *state) run() {
} }
select { select {
// try to send // Try to send
case s.snapCh <- *snapCopy: case s.snapCh <- *snapCopy:
s.logger.Trace("Delivered new snapshot to proxy config watchers") s.logger.Trace("Delivered new snapshot to proxy config watchers")
@ -635,10 +635,12 @@ func (s *state) run() {
// this iteration // this iteration
continue continue
// avoid blocking if a snapshot is already buffered, but queue up a retry with a timer // Avoid blocking if a snapshot is already buffered in snapCh as this can result in a deadlock.
// See PR #9689 for more details.
default: default:
s.logger.Trace("Failed to deliver new snapshot to proxy config watchers") s.logger.Trace("Failed to deliver new snapshot to proxy config watchers")
// Reset the timer to retry later. This is to ensure we attempt to redeliver the updated snapshot shortly.
if coalesceTimer == nil { if coalesceTimer == nil {
coalesceTimer = time.AfterFunc(coalesceTimeout, func() { coalesceTimer = time.AfterFunc(coalesceTimeout, func() {
sendCh <- struct{}{} sendCh <- struct{}{}