| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, that's a lot of locks.
Sorry, something went wrong.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
Remaining question: should we backport this enhancement (bugfix?) to Python 3.13? |
Sorry, something went wrong.
Yeah, I had the same thought. I'll leave that decision to @Yhg1s |
Sorry, something went wrong.
Sorry, something went wrong.
|
Without this change, the ssl module is not usable on a Free Threaded build (it does easily crash). The change only affects the Free Threaded build: adding @critical_section does nothing in the regular build, and the added test is ignored on regular Python (only run on Free Threading). I would be fine with no backporting it, since Free Threading remains experimental. |
Sorry, something went wrong.
|
I think that fixing the SSL module crash in the 3.13 free threading build is important -- lots of basic tasks around HTTP requests are likely to crash without it. I don't think "lines of code changed" is a good measure of the complexity here -- the Modules/_ssl.c changes are mostly mechanical, and the only behavioral changes is additional locking in the free threading build. If backporting this PR is a nonstarter than we should consider a smaller, more targeted change that only adds @critical_section to SSLContext methods (without changing getters and setters). That seems less ideal to me, but should fix the common SSL crash and be a pretty small code change. |
Sorry, something went wrong.
|
Also, thank you @ZeroIntensity for fixing this bug and @vstinner, @corona10, and everyone else that reviewed the PR. |
Sorry, something went wrong.
|
Thanks @ZeroIntensity for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
|
Sorry, @ZeroIntensity and @vstinner, I could not cleanly backport this to 3.13 due to a conflict. cherry_picker 4c53b2577531c77193430cdcd66ad6385fcda81f 3.13 |
Sorry, something went wrong.
|
@ZeroIntensity: Automated backport failed. Would you mind to backport the change manually? With a backport, it might be easier to take a decision on fixing 3.13 or not. |
Sorry, something went wrong.
|
Yeah, I can do it later today. |
Sorry, something went wrong.
|
GH-125780 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
Make SSL objects thread safe in Free Theaded build by using critical sections. (cherry picked from commit 4c53b25) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
@Yhg1s: Are you still against the backport to 3.13 after @colesbury's comment? |
Sorry, something went wrong.
|
I'm okay with a backport of just the @critical_section changes (since those expand to nothing in the normal build, and the free-threaded build is experimental anyway). It's the larger refactorings that worry me. |
Sorry, something went wrong.
Other changes are tests and changes to use the code declared with @critical_section. |
Sorry, something went wrong.
|
There isn't any other refactoring going on here, I just had to switch the getters and setters over to AC for the critical section. Another issue is that not backporting this to 3.13 will also hurt any automatic backports for ssl in the future. |
Sorry, something went wrong.
Make SSL objects thread safe in Free Theaded build by using critical sections. (cherry picked from commit 4c53b25) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Make SSL objects thread safe in Free Theaded build by using critical sections. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
| #endif | ||
| #if defined(_SSL__SSLCONTEXT_SECURITY_LEVEL_GETSETDEF) | ||
| # undef _SSL__SSLCONTEXT_SECURITY_LEVEL_GETSETDEF | ||
| # define _SSL__SSLCONTEXT_SECURITY_LEVEL_GETSETDEF {"security_level", (getter)_ssl__SSLContext_security_level_get, (setter)_ssl__SSLContext_security_level_set, _ssl__SSLContext_security_level_DOCSTR}, |
There was a problem hiding this comment.
The symbol _ssl__SSLContext_security_level_set is used here, but nowhere added
Sorry, something went wrong.
There was a problem hiding this comment.
This is generated clinic code. I'm pretty sure this route is never taken, and the macro right after this is used instead.
Sorry, something went wrong.
There was a problem hiding this comment.
Oh, thank you. I didn't know that
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
As it turns out, OpenSSL doesn't like being called in multiple threads. This adds a per-socket (and per-context and per-session) lock for all OpenSSL calls.