-
Notifications
You must be signed in to change notification settings - Fork 959
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
fix(libs/header/sync): Make ranges.Add thread-safe #1649
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tzdybal
requested review from
renaynay,
Wondertan,
vgonkivs and
distractedm1nd
as code owners
January 27, 2023 09:52
tzdybal
force-pushed
the
tzdybal/fix_ranges
branch
from
January 27, 2023 09:56
969eda7
to
cde501d
Compare
Can you try to run the reconstruction swamp teat locally with -count 100 to see if it's really fixes it? Good catch anyway! |
renaynay
changed the title
fix: make ranges.Add thread-safe
fix(libs/header/sync): Make ranges.Add thread-safe
Jan 27, 2023
renaynay
previously approved these changes
Jan 27, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me - am running it against arabica where a lot of these issues were observed and looks good so far.
Thanks for the fix @tzdybal
tzdybal
force-pushed
the
tzdybal/fix_ranges
branch
from
January 30, 2023 18:53
cde501d
to
b8ae899
Compare
renaynay
approved these changes
Jan 30, 2023
Wondertan
approved these changes
Jan 31, 2023
renaynay
pushed a commit
to renaynay/celestia-node
that referenced
this pull request
Jan 31, 2023
renaynay
pushed a commit
that referenced
this pull request
Feb 1, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
ranges.Add
method is not thread safe. if you execute it in parallel you can end up with ranges out-of-order.In
syncer.newNetHead
nothing prohibits parallel execution ofpending.Add
- syncing point is inwantSync
using buffered channel.newNetHead
is called ass libp2p gossip validator, which is asynchronous - can be executed in parallel.This change ensures that
Add
method is thread-safe.Added test fails in first commit (to proof the point), and second commit fixes the issue.
Probably fixes #955. My gut feeling is that is also may fix other, more-nuanced, non-panicing sync issues.
Checklist