-
Notifications
You must be signed in to change notification settings - Fork 586
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
fix: Race condition inside internal cache implementation #4013
Conversation
Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
6ebda6b
to
c51b8dc
Compare
Thanks for your contribution @Stranger6667! Be aware that we don't test or formally guarantee the thread safety of Hypothesis tests (https://hypothesis.readthedocs.io/en/latest/details.html#thread-safety-policy). However, the change looks good to me, and I agree it should not significantly slow down single-thread performance. Is my understanding correct that it effectively makes the cache per-thread? If so, there may be a concern about total memory usage — but again, not in the single threaded case. To proceed, you will need to create |
Thank you for checking the PR, @jobh! As far as I remember, there were some tests I added some years ago for a thread-safety issue in
Yes, you are right. I went this road mainly due to its simplicity and that there are already some places that use Yep, the |
My apologies 😁 I saw the whole-repo failure and thought this was the issue. It is just another numpy issue which is fixed elsewhere. |
No, not at all. Just a heads-up, that's all; we're happy if it works! |
Starting with the upgrade to Hypothesis 6.103.4 we got hangs when pytest exits. This is caused by: HypothesisWorks/hypothesis#4013 combined with: python/cpython#102126 which was fixed in Python 3.10.11, but the latest 3.10 packaged by Archlinux was 3.10.10. Thus, we instead build a newer 3.10 from the AUR. This bumps the build time up to about 20 minutes on my machine, which is probably acceptable since those are nightly builds only anyways. We could probably half that by disabling --enable-optimization, but that would be at the cost of making the actual test runs (which run more often) slower. Closes #8247
The issue is when multiple tests share the same cache kwargs, it may lead to an error like the one reported in schemathesis/schemathesis#2269
Hopefully, the performance impact is negligible. At the moment I can't come up with a reasonably small test to reproduce the issue.