Skip to content

fix: eliminate data races in Debugger and ServiceKey#977

Merged
holyfuchs merged 2 commits intomasterfrom
holyfuchs/fix-data-races
Mar 27, 2026
Merged

fix: eliminate data races in Debugger and ServiceKey#977
holyfuchs merged 2 commits intomasterfrom
holyfuchs/fix-data-races

Conversation

@holyfuchs
Copy link
Copy Markdown
Member

Debugger.listener was written in Start() and read in Stop() concurrently with no synchronization. Added a mutex to guard all accesses and a stopped flag so if Stop() runs before Start() sets the listener, Start() detects it and closes the listener immediately instead of starting the serve loop.

defaultConfig is a package-level variable whose ServiceKey.PrivateKey is a shared pointer across all tests. The onflow/crypto library lazily initializes the public key inside the private key struct without synchronization, causing a race when parallel tests both trigger PublicKey(). Fixed by eagerly initializing and storing the public key at key-generation time, removing the lazy path entirely.

@github-actions
Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@holyfuchs holyfuchs merged commit 9f37272 into master Mar 27, 2026
7 checks passed
@holyfuchs holyfuchs deleted the holyfuchs/fix-data-races branch March 27, 2026 17:15
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.

2 participants