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

common/prque, eth/downloader: fix timeout resurrection panic #26652

Merged
merged 2 commits into from
Feb 9, 2023
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
5 changes: 3 additions & 2 deletions eth/downloader/fetchers_concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,14 @@ func (d *Downloader) concurrentFetch(queue typedQueue, beaconMode bool) error {
// overloading it further.
delete(pending, req.Peer)
stales[req.Peer] = req
delete(ordering, req)

timeouts.Pop()
timeouts.Pop() // Popping an item will reorder indices in `ordering`, delete after, otherwise will resurrect!
if timeouts.Size() > 0 {
_, exp := timeouts.Peek()
timeout.Reset(time.Until(time.Unix(0, -exp)))
}
delete(ordering, req)

// New timeout potentially set if there are more requests pending,
// reschedule the failed one to a free peer
fails := queue.unreserve(req.Peer)
Expand Down