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

fix: deadlock when signing with the same validator in parallel #108

Merged
merged 10 commits into from
Oct 28, 2024

Conversation

y0sher
Copy link
Contributor

@y0sher y0sher commented Aug 28, 2024

Description

Together with @moshe-blox and with some input from @vaclav-ssvlabs and @zktaiga , we realized the change we are doing to alan might try signing with the same validator (for different slots) at the same time in parallel.

Regression test added.

The bug

// get validator lock
Goroutine1 -> mapLock.Lock
Gorotouine1 (defer mapLock.Unlock)
     Goroutine1 -> ValidatorLock.Lock()
defer executed

// second get validator lock
Goroutine2 -> mapLock.Lock()
   Goroutine2 -> ValidatorLock.Lock() // stuck here

// release first validator lock
Goroutine1 -> mapLock.Lock() // stuck here before first is still stuck on ValidatorLock
** DEADLOCK **

@y0sher y0sher requested review from alonmuroch, olegshmuelov, moshe-blox and liorrutenberg and removed request for alonmuroch August 28, 2024 17:53
@y0sher y0sher changed the title test: sign with the same validator in parallel on the same time. fix: sign with the same validator in parallel on the same time. Aug 28, 2024
@y0sher y0sher marked this pull request as ready for review October 22, 2024 12:53
Copy link
Contributor

@moshe-blox moshe-blox left a comment

Choose a reason for hiding this comment

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

LGTM

@y0sher y0sher requested review from olegshmuelov and removed request for olegshmuelov and alonmuroch October 27, 2024 14:52
wallets/account.go Outdated Show resolved Hide resolved
@moshe-blox moshe-blox changed the title fix: sign with the same validator in parallel on the same time. fix: deadlock when signing with the same validator in parallel Oct 27, 2024
@moshe-blox moshe-blox merged commit e6bc06b into master Oct 28, 2024
4 of 5 checks passed
@moshe-blox moshe-blox deleted the test/sign-validator-parallel branch October 28, 2024 08:52
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