Skip to content

Commit e0115bb

Browse files
k8s-ci-robotipochi
authored andcommitted
Merge pull request #775 from kinvolk/imran/fix-stale-servercount-update
fix: avoid stale server count update (cherry picked from commit 62bba95)
1 parent e3f2a9a commit e0115bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/agent/clientset.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,14 @@ func (cs *ClientSet) connectOnce() (int, error) {
275275
if err != nil {
276276
return serverCount, err
277277
}
278-
cs.lastReceivedServerCount = receivedServerCount
279278
if err := cs.AddClient(c.serverID, c); err != nil {
280279
c.Close()
281280
return serverCount, err
282281
}
282+
// By moving the update to here, we only accept the server count from a server
283+
// that we have successfully added to our active client set, implicitly ignoring
284+
// stale data from duplicate connection attempts.
285+
cs.lastReceivedServerCount = receivedServerCount
283286
klog.V(2).InfoS("sync added client connecting to proxy server", "serverID", c.serverID)
284287

285288
labels := runpprof.Labels(

0 commit comments

Comments
 (0)