gh-150191: Avoid data race in test_sni_callback_race#150193
Conversation
Use a single handshake thread to avoid OpenSSL-internal data races on shared SSL_CTX state, while keeping multiple togglers to exercise the sni_callback setter race from pythongh-149816.
|
A few other related changes:
|
|
@colesbury Thanks for the test improvements!
Running it for at least 0.1s does dramatically increase the consistency, although I've been told we shouldn't add static delays to the tests, even as small as 0.1s. |
encukou
left a comment
There was a problem hiding this comment.
Thank you for the fix! I have a suggestion to avoid depending on clock time:
|
|
||
| def do_handshakes(): | ||
| while not done.is_set(): | ||
| while time.monotonic() < deadline: |
There was a problem hiding this comment.
What do you think about running a fixed number of iterations here, and when this thread setting an event when it's done?
Strange. That's already the 3rd attempt. Anyway, I restarted the failing job. |
|
I am merging this PR as it is and will implement the suggestion to make it fixed iterations in a followup. |
|
Thanks @colesbury for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
GH-153269 is a backport of this pull request to the 3.15 branch. |
|
GH-153270 is a backport of this pull request to the 3.14 branch. |
Use a single handshake thread to avoid OpenSSL-internal data races on shared SSL_CTX state, while keeping multiple togglers to exercise the sni_callback setter race from gh-149816.