Skip to content

ci: add tests with data race detector #258

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

Merged
merged 12 commits into from
Jan 16, 2023

Conversation

oleg-jukovec
Copy link
Collaborator

@oleg-jukovec oleg-jukovec commented Jan 9, 2023

The patchset adds tests with race detector. It also fixes founded problems.

You could review commits one by one with the command:

$ go test -race -v ./...

I didn't forget about (remove if it is not applicable):

Related issues:

Closes #218

Copy link

@better0fdead better0fdead left a comment

Choose a reason for hiding this comment

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

Hi, thx for patch. Seems like LGTM to me.

Initial requests should not use a schema because it has not been
loaded yet.

Part of #218
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-218-schema-data-race branch from a591c9a to 05c26aa Compare January 13, 2023 09:01
We need to block shards to avoid schema usage by concurrent requests.
Now it can be a ping request or a watch request so it does not look
critical. We don't expect many of this requests and such requests
do not use schema at all.

Part of #218
We need to use an atomic method to read the atomic value.

Part of #218
A use-case from our code: a response per AppendPush(). It looks like
it's enough to change the test.

Part of #218
We need to update an addresses slice under a lock because
we use the slice in ConnectionMulti.getCurrentConnection().

Part of #218
We need to use an atomic method to update the atomic value.

Part of #218
You need to protect the poolWatcher.unregistered variable to avoid
the data race. It does not look too critical because we don't
expect that performance of poolWatcher.Unregister() is matter
in cuncurrent calls case.

It could also lead to crashes.

Part of #218
It is better to use atomic counters.

Part of #218
It is better to use atomic counters.

Part of #218
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-218-schema-data-race branch 2 times, most recently from 3a92abe to 5102ac2 Compare January 16, 2023 10:39
oleg-jukovec and others added 3 commits January 16, 2023 13:55
Tests execution result may differ due to different timings, so it is
better to test together, rather than instead.

Closes #218
@oleg-jukovec oleg-jukovec force-pushed the oleg-jukovec/gh-218-schema-data-race branch from 5102ac2 to a6dd70e Compare January 16, 2023 10:56
@oleg-jukovec oleg-jukovec merged commit a22527a into master Jan 16, 2023
@oleg-jukovec oleg-jukovec deleted the oleg-jukovec/gh-218-schema-data-race branch January 16, 2023 11:20
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
3 participants