-
Notifications
You must be signed in to change notification settings - Fork 22
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
Document that hypothesis is thread-unsafe #116
Comments
@Zac-HD as a hypothesis maintainer I'd appreciate your take on my assessment here. |
You're correct that Hypothesis is not threadsafe. I haven't yet worked out what to do about that given free-threading changes; it'd be great to support but also we really do have to manage some global state. Upstream issue: HypothesisWorks/hypothesis#4028 |
Is this mostly a matter of not being able to use tools like |
It's the same as pytest, it's fine to spawn worker threads in a hypothesis test but hypothesis itself has a lot of thread safety issues so if you use constructs provided by hypothesis in a multithreaded context or use hypothesis itself in many threads than you will likely hit issues. Lots of race conditions around global registries and that sort of thing. There's also an on-disk results db that may or may not have thread safety issues. |
The database is safe for concurrent use from multiple threads (it's a very basic best-effort KV store), entirely correct on the rest. |
See https://hypothesis.readthedocs.io/en/latest/details.html#thread-safety-policy and indygreg/python-zstandard#243 for a time this came up in the real world.
The text was updated successfully, but these errors were encountered: