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 rare TestResumption deadlock #44821

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions lib/resumption/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ func runClientResumableUnlocking(ctx context.Context, resumableConn *Conn, first
case <-detached:
}

reconnectTicker.Stop()
select {
case <-reconnectTicker.Chan():
default:
}

slog.DebugContext(ctx, "connection lost, starting reconnection loop", "host_id", hostID)
reconnectDeadline := time.Now().Add(reconnectTimeout)
backoff := minBackoff
Expand Down Expand Up @@ -262,10 +268,6 @@ func runClientResumableUnlocking(ctx context.Context, resumableConn *Conn, first
}

reconnectTicker.Reset(replacementInterval)
select {
case <-reconnectTicker.Chan():
default:
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions lib/resumption/resumption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ func testResumption(t *testing.T, network, address string, expectedHostID string
default:
}

// wait until the reconnection loop has passed the reconnection phase
// and is waiting on the reconnection timer again
clock.BlockUntil(1)
clock.Advance(replacementInterval)
redialingSyncPoint <- struct{}{}

Expand Down
Loading