Skip to content

Conversation

@lunny
Copy link

@lunny lunny commented Sep 8, 2020

This PR will try to fix the data race described on #1460.

When invoking Batch, a goroutine will be ruined and will read batch.IndexOps. Meanwhile, the user may call batch.Reset immediately which will clear batch.IndexOps. The PR will copy the point of the map to the goroutine but not read it directly to avoid the datarace.

@mschoch
Copy link
Contributor

mschoch commented Sep 8, 2020

The comment in this fix suggests that the API is being used incorrectly. We do not support resetting a batch until after batch execution is complete, at which time copying that slice is not required.

Can we start with a unit test that you think contains valid use of the API that fails the race dectector?

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