@@ -354,7 +354,13 @@ func (a *Client) Serve() {
354
354
if status .Code (err ) == codes .Canceled {
355
355
klog .V (2 ).InfoS ("stream canceled" , "serverID" , a .serverID , "agentID" , a .agentID )
356
356
} else {
357
- klog .ErrorS (err , "could not read stream" , "serverID" , a .serverID , "agentID" , a .agentID )
357
+ select {
358
+ case <- a .stopCh :
359
+ klog .V (5 ).InfoS ("could not read stream because agent client is shutting down" , "serverID" , a .serverID , "agentID" , a .agentID , "err" , err )
360
+ default :
361
+ // If stopCh is not closed, this is a legitimate, unexpected error.
362
+ klog .ErrorS (err , "could not read stream" , "serverID" , a .serverID , "agentID" , a .agentID )
363
+ }
358
364
}
359
365
return
360
366
}
@@ -407,7 +413,13 @@ func (a *Client) Serve() {
407
413
closePkt .GetCloseResponse ().ConnectID = connID
408
414
}
409
415
if err := a .Send (closePkt ); err != nil {
410
- klog .ErrorS (err , "close response failure" , "" )
416
+ if err == io .EOF {
417
+ klog .V (4 ).InfoS ("received EOF; connection already closed" , "connectionID" , connID , "dialID" , dialReq .Random , "err" , err )
418
+ } else if _ , ok := a .connManager .Get (connID ); ! ok {
419
+ klog .V (5 ).InfoS ("connection already closed" , "connectionID" , connID , "dialID" , dialReq .Random , "err" , err )
420
+ } else {
421
+ klog .ErrorS (err , "close response failure" , "connectionID" , connID , "dialID" , dialReq .Random )
422
+ }
411
423
}
412
424
close (dataCh )
413
425
a .connManager .Delete (connID )
0 commit comments