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 ANTLR related data-race. #177

Merged
merged 3 commits into from Mar 5, 2019

Conversation

TristonianJones
Copy link
Collaborator

Issue #175 pointed out a data race within the parser which occurs when the parsing is run in parallel. The issue appears to be related to the ANTLR Go Codegen which creates mutable global variables during parser generation.

The best available fix, shy of addressing the Go codegen and ANLTR Go runtime libraries, is to make the global state per-instance. This will likely have a performance impact, but it's difficult to characterize at this time.

@@ -852,6 +852,7 @@ func TestParse(t *testing.T) {
for i, tst := range testCases {
name := fmt.Sprintf("%d %s", i, tst.I)
t.Run(name, func(tt *testing.T) {
tt.Parallel()
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment explaining why it's important to parallelize here.

@@ -1127,6 +1127,7 @@ func TestCheck(t *testing.T) {
for i, tst := range testCases {
name := fmt.Sprintf("%d %s", i, tst.I)
t.Run(name, func(tt *testing.T) {
tt.Parallel()
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment explaining why we parallelize here.

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.

None yet

2 participants