Skip to content
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

fix: make closing connection not reconnect and actually kill the routine #3682

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions agent/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ func (c *Client) getName() (string, error) {
}

func isCancelledError(err error) bool {
return err != nil && strings.Contains(err.Error(), "context canceled")
if err == nil {
return false
}

return strings.Contains(err.Error(), "context canceled") || strings.Contains(err.Error(), "the client connection is closing")
}

func (c *Client) reconnect() error {
Expand Down Expand Up @@ -248,7 +252,6 @@ func isConnectionError(err error) bool {
// From time to time, the server can start sending those errors to the
// agent. This mitigates the risk of an agent getting stuck in an error state
"unexpected HTTP status code received from server: 500",
"the client connection is closing",
}
for _, possibleErr := range possibleErrors {
if strings.Contains(err.Error(), possibleErr) {
Expand Down