-
Notifications
You must be signed in to change notification settings - Fork 894
fix: ensure wsproxy MultiAgent
is closed when websocket dies
#11414
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
MultiAgent
is closed when websocket dies
The `SingleTailnet` behavior only checked to see if the `MultiAgent` was closed, but the websocket error was not being propogated into the `MultiAgent`, causing it to never be swapped for a new working one.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -472,6 +472,11 @@ func (c *Client) DialCoordinator(ctx context.Context) (agpl.MultiAgentConn, erro | |
OnRemove: func(agpl.Queue) { conn.Close(websocket.StatusGoingAway, "closed") }, | ||
}).Init() | ||
|
||
go func() { | ||
<-ctx.Done() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm understanding this correctly, we're depending on the fact that the reader goroutine below cancels the context on a failed read. I think we should also tear down the multi-agent on a failed write of subscription messages. It's unlikely that we'd have a failure that leaves the connection half-open (e.g. for reads but not writes), but such things are possible and you don't want the proxy limping on unable to subscribe to new agents. |
||
ma.Close() | ||
}() | ||
|
||
go func() { | ||
defer cancel() | ||
dec := json.NewDecoder(nc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[Re: lines 488 to 488]
I think it's worth dropping an INFO log here. See this comment inline on Graphite. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop an INFO log here
See this comment inline on Graphite.