henry icon indicating copy to clipboard operation
henry copied to clipboard

Data race when using slicez.Shuffle and slicez.Sample concurrently

Open larsve opened this issue 7 months ago • 1 comments

The rand changes in https://github.com/modfin/henry/commit/96a84d86c74e246a496e8e34895318bb162accd1 is not concurrency safe, so if slicez.Shuffle or slicez.Sample is used concurrently, a data race may occur.

When operating directly on the rand package, a lockedSource is used internally to make the package methods concurrency safe, but rand.NewSource return a rand.Source that don't have any lock/mutex.

More information can be found here: https://github.com/golang/go/issues/21393

larsve avatar Jul 08 '24 13:07 larsve