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

eth/downloader: abort sync if master drops (timeout prev) #2868

Merged
merged 1 commit into from
Aug 9, 2016

Conversation

karalabe
Copy link
Member

Currently the downloader tracks peer drops for "data downloads", so that if a remote node is disconnected, all its assigned fetches are returned into the queue to be pulled by someone else.

However fetching the remote height; fetching the common ancestor and fetching the skeleton chain are done outside of the "fetch queue", so none of these code segments are aware that a peer was dropped. This results in them having to wait for a timeout to hit before aborting and starting over. Given the EDGE release's bumped timeout of 1 minute, this can stall sync quite a lot.

This PR adds a minor polish to the downloader so that for every sync cycle it maintains the master peer that it wants to sync with. Subsequently if the master peer is dropped, the sync cycle is cancelled in its entirety.

@robotally
Copy link

robotally commented Jul 26, 2016

Vote Count Reviewers
👍 1 @fjl
👎 0

Updated: Mon Aug 8 08:42:29 UTC 2016

@fjl
Copy link
Contributor

fjl commented Jul 26, 2016

👍

General observation: maybe the cancel channel should be passed into fetchHeight, fetchAncestor, ... to guard against races. They all read from d.cancel without synchronisation which might be OK but it's safer to just pass the channel around.

@fjl fjl modified the milestone: 1.4.11 Aug 5, 2016
@obscuren
Copy link
Contributor

obscuren commented Aug 8, 2016

LGTM 👍

@karalabe karalabe merged commit b46b367 into ethereum:develop Aug 9, 2016
@obscuren obscuren removed the review label Aug 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants