Skip to content

Fix data races with sync package types - #371

Merged
mattn merged 1 commit into
masterfrom
fix-sync-data-race
Jul 9, 2026
Merged

Fix data races with sync package types#371
mattn merged 1 commit into
masterfrom
fix-sync-data-race

Conversation

@mattn

@mattn mattn commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Two data races reported in #363, both visible with go test -race ./vm/ in TestPackagesSync:

  • sync package types were registered as value types, so every VM access copied the lock-containing struct through reflect while goroutines mutated it. They are now registered as pointer types (as suggested in the issue), which also fixes the copylocks misuse itself.
  • anonCallExpr wrote to the shared AST via a self-assigning SetPosition on every call, racing with concurrent execution of the same AST. The call was a no-op and is removed.

The full test suite now passes under -race.

Fixes #363

@mattn
mattn merged commit 6db52de into master Jul 9, 2026
12 checks passed
@mattn
mattn deleted the fix-sync-data-race branch July 10, 2026 00:43
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.

Data race in sync packages

1 participant