Skip to content

fix: use RLock instead of Lock in CollectMachineHashes for concurrent…#3632

Merged
joshuacolvin0 merged 2 commits into
OffchainLabs:masterfrom
crStiv:psosi
Sep 17, 2025
Merged

fix: use RLock instead of Lock in CollectMachineHashes for concurrent…#3632
joshuacolvin0 merged 2 commits into
OffchainLabs:masterfrom
crStiv:psosi

Conversation

@crStiv

@crStiv crStiv commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

Fix concurrency issue in BOLDStateProvider.CollectMachineHashes method.

The method was using s.Lock() which blocks all other operations on the BOLDStateProvider, including other read operations.

This creates a severe performance bottleneck in the BOLD protocol where multiple Edge Trackers can call CollectMachineHashes concurrently.

Changes:

  • Replace s.Lock() with s.RLock() in CollectMachineHashes method
  • This allows multiple concurrent read operations while maintaining thread safety
  • Aligns with the BOLD protocol's requirement for concurrent challenge participation

@rauljordan rauljordan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice find!

@joshuacolvin0 joshuacolvin0 merged commit 4363545 into OffchainLabs:master Sep 17, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants