Closed peterargue closed 7 months ago
That's really strange, the panic you are seeing comes from endGroup
call at line 69
https://github.com/flyingmutant/rapid/blob/d56e0371c298310defbd867b24ab21ef7bf169bb/utils.go#L64-L69
However, that group always contain a call to genGeom
, which always draws 53 bits:
https://github.com/flyingmutant/rapid/blob/d56e0371c298310defbd867b24ab21ef7bf169bb/utils.go#L26-L37
Maybe there is something incorrect happening with regards to concurrent access to generators? Note the documentation:
For tests to be reproducible, they should generally run in a single goroutine. If concurrency is unavoidable, methods on T, such as [testing.T.Helper](https://pkg.go.dev/testing#T.Helper) and *T.Errorf, are safe for concurrent calls, but Generator.Draw from a given T is not.
Thanks for getting back so quick @flyingmutant!
Yes, it seems to be an issue with concurrency. I wrapped my call to Draw
with a mutex and the crashes stopped. I misinterpreted that note to mean for a given generator, not T
. Thanks for clarifying.
I'm running
v1.1.0
I get the following error randomly running tests that exclusively use of the built in generators:
The specific line it fails on is
The test involves some
testify
mocks and a grpc client/server interaction. It fails with this panic ~1/20 runs.Unfortunately, I haven't been able to create a reproduction that doesn't involve a bunch of our test code, but I have seen it in a couple different tests.