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

ruleguard/typematch: use external matcher state #374

Merged
merged 1 commit into from
Jan 30, 2022

Conversation

quasilyte
Copy link
Owner

This is the same trick we did with gogrep matcher.
The caller is supposed to pass the state that is not
shared between different threads.

For the most use cases, ruleguard has worker/runner based
concurrency, so it's easy to pass this state from the
worker that owns that state and doesn't share it with
other workers.

Also added some E2E tests that compile a ruleguard binary
with -race and run it using all test rules over the ruleguard
own source code. If any of these rules cause a data race,
this test fails.

To avoid the slower test times, I removed the -race from
the basic test as they do not involve any concurrent behavior
anyway, so it was just a waste of time.

Fixes #372
Fixes #368

This is the same trick we did with gogrep matcher.
The caller is supposed to pass the state that is not
shared between different threads.

For the most use cases, ruleguard has worker/runner based
concurrency, so it's easy to pass this state from the
worker that owns that state and doesn't share it with
other workers.

Also added some E2E tests that compile a ruleguard binary
with `-race` and run it using all test rules over the ruleguard
own source code. If any of these rules cause a data race,
this test fails.

To avoid the slower test times, I removed the `-race` from
the basic test as they do not involve any concurrent behavior
anyway, so it was just a waste of time.

Fixes #372
Fixes #368
@quasilyte quasilyte merged commit eb19bc4 into master Jan 30, 2022
@quasilyte quasilyte deleted the quasilyte/fix_typematch_race branch January 30, 2022 19:27
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.

Concurrent map write error Add reliable race tests
1 participant