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

[v15] Fix panic in app dialing #42786

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Changes from all commits
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: 11 additions & 5 deletions lib/web/app/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,18 @@ func (t *transport) DialContext(ctx context.Context, _, _ string) (conn net.Conn
break
}

// eliminate any servers from the head of the list that were unreachable
t.mu.Lock()
if i < len(servers) {
t.c.servers = t.c.servers[i:]
} else {
t.c.servers = nil
// Only attempt to tidy up the list of servers if they weren't altered
// while the dialing happened. Since the lock is only held initially when
// making the servers copy and released during the dials, another dial attempt
// may have already happened and modified the list of servers.
if len(servers) == len(t.c.servers) {
// eliminate any servers from the head of the list that were unreachable
if i < len(t.c.servers) {
t.c.servers = t.c.servers[i:]
} else {
t.c.servers = nil
}
}
t.mu.Unlock()

Expand Down
Loading