GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: prevent tailnet coordination panics by dylanhuff-at-coder · Pull Request #29300 · coder/coder Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lgtm, except for one potential P2 and some nits.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| func (p *peer) reqLoop(ctx context.Context, logger slog.Logger, handler func(context.Context, *peer, *proto.CoordinateRequest) error) error { | ||
| func (p *peer) reqLoop(ctx context.Context, logger slog.Logger, handler func(context.Context, *peer, *proto.CoordinateRequest) error) (err error) { | ||
| defer func() { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Just a heads-up, this recovery is not at the top of the goroutine, so if the rest of the goroutine's clean up code panics, coderd will still crash. While the original issue asks for a recovery around "coordinator per-connection goroutine".
On the other hand, the bug seems to be covered, so this is a non-blocking nit.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good catch, added recovery around the outer goroutine too, with a regression test for a panic during cleanup.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return xerrors.Errorf("node update failed: %w", err) | ||
| } | ||
| } | ||
| if req.AddTunnel != nil { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
An agent found this:
nodeUpdateLockedcan now return successfully after recursive fan-out removesp. A compound request then continues into AddTunnel using the stale peer, potentially creating an orphan tunnel or sending on its closed response channel. Recheckc.peers[p.id] == pand returnErrAlreadyRemovedbefore continuing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Added the peer recheck after fan-out, plus regression cases for compound requests with AddTunnel and ReadyForHandshake.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| func (m *mapper) run() { | ||
| defer func() { | ||
| if recovered := recover(); recovered != nil { | ||
| m.logger.Error(m.ctx, "panic mapping peer responses (recovered)", |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Would "panic processing peer mappings (recovered)" be more clear?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that reads better. Updated.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| name: "NilReadyForHandshake", | ||
| req: &proto.CoordinateRequest{ReadyForHandshake: []*proto.CoordinateRequest_ReadyForHandshake{nil}}, | ||
| err: "ready_for_handshake entry is required", |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: Should this say ready_for_handshake entries must not be nil? “Entry is required” could imply the list must be non-empty, although an empty list is valid here I think?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good point, an empty list is valid. Updated the message and test expectations.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Contain cleanup panics at the connection goroutine boundary and stop compound requests when node update fan-out removes their peer. Clarify recovered mapping and nil handshake entry messages. Generated by Coder Agents.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.