From e1b1c1cc80438878ca0b0cbeccfef14bd850d6e8 Mon Sep 17 00:00:00 2001 From: Kubernetes Prow Robot <20407524+k8s-ci-robot@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:04:07 -0700 Subject: [PATCH] Merge pull request #775 from kinvolk/imran/fix-stale-servercount-update fix: avoid stale server count update (cherry picked from commit 62bba958e575f4be0753753552304eb5a7854140) --- pkg/agent/clientset.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/agent/clientset.go b/pkg/agent/clientset.go index e620d0e66..886bf85b7 100644 --- a/pkg/agent/clientset.go +++ b/pkg/agent/clientset.go @@ -300,11 +300,14 @@ func (cs *ClientSet) connectOnce() (int, error) { if err != nil { return serverCount, err } - cs.lastReceivedServerCount = receivedServerCount if err := cs.AddClient(c.serverID, c); err != nil { c.Close() return serverCount, err } + // By moving the update to here, we only accept the server count from a server + // that we have successfully added to our active client set, implicitly ignoring + // stale data from duplicate connection attempts. + cs.lastReceivedServerCount = receivedServerCount klog.V(2).InfoS("sync added client connecting to proxy server", "serverID", c.serverID) labels := runpprof.Labels(