Skip to content

Commit c263456

Browse files
committed
fix: avoid stale server count update
Signed-off-by: Imran Pochi <[email protected]>
1 parent 4e13dbb commit c263456

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
@@ -214,11 +214,14 @@ func (cs *ClientSet) connectOnce() error {
214214
"current", cs.serverCount, "serverID", c.serverID, "actual", serverCount)
215215

216216
}
217-
cs.serverCount = serverCount
218217
if err := cs.AddClient(c.serverID, c); err != nil {
219218
c.Close()
220219
return err
221220
}
221+
// By moving the update to here, we only accept the server count from a server
222+
// that we have successfully added to our active client set, implicitly ignoring
223+
// stale data from duplicate connection attempts.
224+
cs.serverCount = serverCount
222225
klog.V(2).InfoS("sync added client connecting to proxy server", "serverID", c.serverID)
223226

224227
labels := runpprof.Labels(

0 commit comments

Comments
 (0)