Skip to content

Stopping logging error when the connection no longer exists #753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pkg/agent/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,13 @@ func (a *Client) Serve() {
if status.Code(err) == codes.Canceled {
klog.V(2).InfoS("stream canceled", "serverID", a.serverID, "agentID", a.agentID)
} else {
klog.ErrorS(err, "could not read stream", "serverID", a.serverID, "agentID", a.agentID)
select {
case <-a.stopCh:
klog.V(5).InfoS("could not read stream because agent client is shutting down", "err", err)
default:
// If stopCh is not closed, this is a legitimate, unexpected error.
klog.ErrorS(err, "could not read stream", "serverID", a.serverID, "agentID", a.agentID)
}
}
return
}
Expand Down Expand Up @@ -407,7 +413,13 @@ func (a *Client) Serve() {
closePkt.GetCloseResponse().ConnectID = connID
}
if err := a.Send(closePkt); err != nil {
klog.ErrorS(err, "close response failure", "")
if err == io.EOF {
klog.V(2).InfoS("received EOF; connection already closed", "connectionID", connID, "err", err)
} else if _, ok := a.connManager.Get(connID); !ok {
klog.V(5).InfoS("connection already closed", "connectionID", connID, "err", err)
} else {
klog.ErrorS(err, "close response failure", "")
}
}
close(dataCh)
a.connManager.Delete(connID)
Expand Down