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

x/sync: add locks for peerTracker #1756

Merged
merged 4 commits into from
Jul 25, 2023
Merged

x/sync: add locks for peerTracker #1756

merged 4 commits into from
Jul 25, 2023

Conversation

darioush
Copy link
Contributor

@darioush darioush commented Jul 24, 2023

Resolves: #1750
Replaces: #1751

Why this should be merged

Fixes issues with concurrent map accesses during sync.
It seems this data structure could be used concurrently (comparatively the locking overhead seems small).

How this works

Adds lock for the peer tracker.

How this was tested

UT, hyper SDK CI ava-labs/hypersdk#272

@darioush darioush marked this pull request as ready for review July 24, 2023 20:17
@patrick-ogrady
Copy link
Contributor

Do we want to remove any locking from network_client.go?

@patrick-ogrady patrick-ogrady changed the title sync: add locks for peerTracker x/sync: add locks for peerTracker Jul 24, 2023
@patrick-ogrady patrick-ogrady linked an issue Jul 24, 2023 that may be closed by this pull request
return ids.EmptyNodeID, nil, fmt.Errorf(
"no peers found matching version %s out of %d peers",
minVersion, c.peers.Size(),
)
}

// Note [c.request] releases [c.lock].
c.lock.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move grabbing this lock into request() now right?

@StephenButtolph StephenButtolph added this to the v1.10.6 milestone Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[x/sync] Concurrent Map Write Panic
3 participants