Skip to content

gh-149816: Fix SNI callback callable race - #150018

Merged
encukou merged 12 commits into
python:mainfrom
kiri11:ssl-rc-ft-49
May 19, 2026
Merged

gh-149816: Fix SNI callback callable race#150018
encukou merged 12 commits into
python:mainfrom
kiri11:ssl-rc-ft-49

Conversation

@kiri11

@kiri11kiri11 commented May 18, 2026

Copy link
Copy Markdown
Contributor

Problem

Fix a use-after-free race in the SSL SNI callback on free-threaded builds. When sni_callback is replaced or cleared on one thread while another thread is mid-handshake, the old callback object could be freed before the handshake thread finishes calling it.

  • Reader side (_servername_callback): acquire sslctx's critical section, snapshot the callback with Py_XNewRef into a local, then release. The local strong reference keeps the callable alive for the duration of the call.
  • Setter side (sni_callback_set): already holds the same critical section via @critical_section clinic annotation. Uses Py_XSETREF to swap the pointer and decref the old callback atomically. The OpenSSL callback registration is set after the pointer is stored, so a concurrent handshake always finds a valid callable.
  • Setter clearing (sni_callback = None): unregisters the OpenSSL callback first, then clears the Python reference. Serialized against the reader by the same critical section.

Testing

Adds a free-threading stress test that spawns handshake workers and a callback-toggling thread concurrently.

Plus manually tested on MacOS.

Before

% ./python.exe-mtesttest_ssl-mtest_sni_callback_raceRaisedRLIMIT_NOFILE: 256->1024Usingrandomseed: 26552055900:00:00loadavg: 4.31Run1testsequentiallyinasingleprocess0:00:00loadavg: 4.31 [1/1] test_ssl==================WARNING: ThreadSanitizer: datarace (pid=68672)
Writeofsize8at0x000126f10588bythreadT29:
#0 _ssl__SSLContext_sni_callback_set_impl _ssl.c:5304 (_ssl.cpython-316t-darwin.so:arm64+0xe5f0)#1 _ssl__SSLContext_sni_callback_set _ssl.c.h:2266 (_ssl.cpython-316t-darwin.so:arm64+0xe5f0)#2 _PyObject_GenericSetAttrWithDict object.c:2049 (python.exe:arm64+0x1000dd900)#3 pythread_wrapper thread_pthread.h:234 (python.exe:arm64+0x10026e378)Previousreadofsize8at0x000126f10588bythreadT13:
#0 _servername_callback _ssl.c:5159 (_ssl.cpython-316t-darwin.so:arm64+0xffa0)#1 final_server_name <null> (libssl.3.dylib:arm64+0x5c31c)#2 _PyEval_EvalFrameDefault generated_cases.c.h:4142 (python.exe:arm64+0x1001c5b50)#3 pythread_wrapper thread_pthread.h:234 (python.exe:arm64+0x10026e378)ThreadT29 (tid=707684, running) createdbymainthreadat:
#0 pthread_create <null> (libclang_rt.tsan_osx_dynamic.dylib:arm64+0x31d84)#1 do_start_joinable_thread thread_pthread.h:281 (python.exe:arm64+0x10026d9f8)#2 do_start_new_thread _threadmodule.c:1919 (python.exe:arm64+0x10032782c)#3 thread_PyThread_start_joinable_thread _threadmodule.c:2042 (python.exe:arm64+0x100326894)#4 cfunction_call methodobject.c:564 (python.exe:arm64+0x1000d27b4)ThreadT13 (tid=707668, running) createdbymainthreadat:
#0 pthread_create <null> (libclang_rt.tsan_osx_dynamic.dylib:arm64+0x31d84)#1 do_start_joinable_thread thread_pthread.h:281 (python.exe:arm64+0x10026d9f8)#2 do_start_new_thread _threadmodule.c:1919 (python.exe:arm64+0x10032782c)#3 thread_PyThread_start_joinable_thread _threadmodule.c:2042 (python.exe:arm64+0x100326894)#4 cfunction_call methodobject.c:564 (python.exe:arm64+0x1000d27b4)SUMMARY: ThreadSanitizer: datarace_ssl.c:5304in_ssl__SSLContext_sni_callback_set_impl==================Warning--UnraisableexceptionExceptionignoredinsslservernamecallbackwhilecallingsetSNIcallback<NULL>:
Traceback (mostrecentcalllast):
File"/Users/kignatev/PycharmProjects/cpython/Lib/ssl.py", line963, indo_handshakeself._sslobj.do_handshake()
~~~~~~~~~~~~~~~~~~~~~~~~~^^SystemError: nullargumenttointernalroutineFatalPythonerror: Segmentationfault<CannotshowallthreadswhiletheGILisdisabled>Stack (mostrecentcallfirst):
<invalidframe>Currentthread'sCstacktrace (mostrecentcallfirst):
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_Py_DumpStack+0x44 [0x104db912c]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atfaulthandler_fatal_error+0x330 [0x104dddf98]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_ZN6__tsanL21CallUserSignalHandlerEPNS_11ThreadStateEbbiPN11__sanitizer23__sanitizer_siginfo_padEPv+0x104 [0x10570f910]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_Z10sighandleriPN11__sanitizer23__sanitizer_siginfo_padEPv+0x1a8 [0x10570fb68]
Binaryfile"/usr/lib/system/libsystem_platform.dylib", at_sigtramp+0x38 [0x182e257a4]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_EvalFrameDefault+0xc71c [0x104d152e4]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_Vector+0x2d8 [0x104d076ec]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atobject_vacall+0x138 [0x104babb78]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atPyObject_CallFunctionObjArgs+0x38 [0x104babce0]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/Modules/_ssl.cpython-316t-darwin.so", at_servername_callback+0x274 [0x10f9c01c8]
Binaryfile"/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib", atfinal_server_name+0x6c [0x113db4320]
Binaryfile"/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib", attls_parse_all_extensions+0xa8 [0x113db3a10]
Binaryfile"/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib", attls_post_process_client_hello+0x560 [0x113dcf678]
Binaryfile"/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib", atstate_machine+0x59c [0x113dbe824]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/Modules/_ssl.cpython-316t-darwin.so", at_ssl__SSLSocket_do_handshake+0x184 [0x10f9c093c]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_EvalFrameDefault+0x4f8c [0x104d0db54]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_Vector+0x2d8 [0x104d076ec]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyObject_VectorcallPrepend+0x144 [0x104bab0c8]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atcontext_run+0x88 [0x104d3b77c]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atPyObject_Vectorcall+0x58 [0x104ba9a40]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_Py_VectorCallInstrumentation_StackRefSteal+0x12c [0x104d07d10]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_EvalFrameDefault+0x21b4 [0x104d0ad7c]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_Vector+0x2d8 [0x104d076ec]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyObject_VectorcallPrepend+0x144 [0x104bab0c8]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atthread_run+0xe0 [0x104e6ff58]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atpythread_wrapper+0x1c [0x104db637c]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at__tsan_thread_start_func+0x8c [0x105709cf8]
Binaryfile"/usr/lib/system/libsystem_pthread.dylib", at_pthread_start+0x88 [0x182e1bc58]
Binaryfile"/usr/lib/system/libsystem_pthread.dylib", atthread_start+0x8 [0x182e16c1c]
ThreadSanitizer:DEADLYSIGNAL==68672==ERROR: ThreadSanitizer: SEGVonunknownaddress0x000000000000 (pc0x000104d0ef10bp0x00017e422240sp0x00017e421fe0T707674)
==68672==ThesignaliscausedbyaREADmemoryaccess.
==68672==Hint: addresspointstothezeropage.
Warning--UnraisableexceptionExceptionignoredinsslservernamecallbackwhilecallingsetSNIcallback<NULL>:
Traceback (mostrecentcalllast):
File"/Users/kignatev/PycharmProjects/cpython/Lib/ssl.py", line963, indo_handshakeself._sslobj.do_handshake()
~~~~~~~~~~~~~~~~~~~~~~~~~^^SystemError: nullargumenttointernalroutine#0 _PyEval_EvalFrameDefault generated_cases.c.h:5550 (python.exe:arm64+0x1001c6f10)#1 _PyEval_EvalFrame pycore_ceval.h:122 (python.exe:arm64+0x1001bf6e8)#2 _PyEval_Vector ceval.c:2156 (python.exe:arm64+0x1001bf6e8)#3 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x100063b74)#4 object_vacall call.c:823 (python.exe:arm64+0x100063b74)#5 PyObject_CallFunctionObjArgs call.c:977 (python.exe:arm64+0x100063cdc)#6 _servername_callback _ssl.c:5214 (_ssl.cpython-316t-darwin.so:arm64+0x101c4)#7 final_server_name <null> (libssl.3.dylib:arm64+0x5c31c)#8 tls_parse_all_extensions <null> (libssl.3.dylib:arm64+0x5ba0c)#9 tls_post_process_client_hello <null> (libssl.3.dylib:arm64+0x77674)#10 state_machine <null> (libssl.3.dylib:arm64+0x66820)#11 _ssl__SSLSocket_do_handshake_impl _ssl.c:1098 (_ssl.cpython-316t-darwin.so:arm64+0x10938)#12 _ssl__SSLSocket_do_handshake _ssl.c.h:30 (_ssl.cpython-316t-darwin.so:arm64+0x10938)#13 _PyEval_EvalFrameDefault generated_cases.c.h:4142 (python.exe:arm64+0x1001c5b50)#14 _PyEval_EvalFrame pycore_ceval.h:122 (python.exe:arm64+0x1001bf6e8)#15 _PyEval_Vector ceval.c:2156 (python.exe:arm64+0x1001bf6e8)#16 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x1000630c4)#17 _PyObject_VectorcallPrepend call.c:855 (python.exe:arm64+0x1000630c4)#18 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x1001f3778)#19 context_run context.c:727 (python.exe:arm64+0x1001f3778)#20 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x100061a3c)#21 PyObject_Vectorcall call.c:327 (python.exe:arm64+0x100061a3c)#22 _Py_VectorCallInstrumentation_StackRefSteal ceval.c:775 (python.exe:arm64+0x1001bfd0c)#23 _PyEval_EvalFrameDefault generated_cases.c.h:1846 (python.exe:arm64+0x1001c2d78)#24 _PyEval_EvalFrame pycore_ceval.h:122 (python.exe:arm64+0x1001bf6e8)#25 _PyEval_Vector ceval.c:2156 (python.exe:arm64+0x1001bf6e8)#26 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x1000630c4)#27 _PyObject_VectorcallPrepend call.c:855 (python.exe:arm64+0x1000630c4)#28 thread_run _threadmodule.c:388 (python.exe:arm64+0x100327f54)#29 pythread_wrapper thread_pthread.h:234 (python.exe:arm64+0x10026e378)#30 __tsan_thread_start_func <null> (libclang_rt.tsan_osx_dynamic.dylib:arm64+0x31cf4)#31 _pthread_start <null> (libsystem_pthread.dylib:arm64e+0x6c54)#32 thread_start <null> (libsystem_pthread.dylib:arm64e+0x1c18)==68672==Registervalues:
x[0] =0x000000010e21dc88x[1] =0x00000001171c02e8x[2] =0x0000000000000000x[3] =0x000000017e422250x[4] =0x0000000000000003x[5] =0x0000000000000000x[6] =0x0000000000000000x[7] =0x0000000000366b00x[8] =0x0000000000000030x[9] =0x00000001171c0338x[10] =0x0000000000000001x[11] =0x0000000000000003x[12] =0x000000010505bda1x[13] =0x0000000000000003x[14] =0x0000000000000075x[15] =0x00000001eec259a0x[16] =0x0000000000000018x[17] =0x000000010e21dc70x[18] =0x0000000000000000x[19] =0x00000001171c0328x[20] =0x00000001171c0358x[21] =0x0000000104fd7da8x[22] =0x000000030e1001c0x[23] =0x000000030e1001c0x[24] =0x0000000000000000x[25] =0x0000000000000001x[26] =0x000000000000001dx[27] =0x00000001171c02e8x[28] =0x00000001240b8000fp=0x000000017e422240lr=0x0000000104d152e4sp=0x000000017e421fe0ThreadSanitizercannotprovideadditionalinfo.
SUMMARY: ThreadSanitizer: SEGVgenerated_cases.c.h:5550in_PyEval_EvalFrameDefault==68672==ABORTINGFatalPythonerror: Aborted<CannotshowallthreadswhiletheGILisdisabled>Stack (mostrecentcallfirst):
<invalidframe>Currentthread'sCstacktrace (mostrecentcallfirst):
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_Py_DumpStack+0x44 [0x104db912c]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atfaulthandler_fatal_error+0x330 [0x104dddf98]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_ZN6__tsanL21CallUserSignalHandlerEPNS_11ThreadStateEbbiPN11__sanitizer23__sanitizer_siginfo_padEPv+0x104 [0x10570f910]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_Z10sighandleriPN11__sanitizer23__sanitizer_siginfo_padEPv+0x1a8 [0x10570fb68]
Binaryfile"/usr/lib/system/libsystem_platform.dylib", at_sigtramp+0x38 [0x182e257a4]
Binaryfile"/usr/lib/system/libsystem_pthread.dylib", atpthread_kill+0x128 [0x182e1b8d8]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", atwrap_pthread_kill+0x134 [0x105710278]
Binaryfile"/usr/lib/system/libsystem_c.dylib", atabort+0x94 [0x182d22790]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_ZN11__sanitizer6AtexitEPFvvE+0x0 [0x1056f11b4]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_ZN11__sanitizer3DieEv+0x68 [0x1056f06e4]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_ZN11__sanitizer13SignalContextC1EPvS1_+0x0 [0x1056fd974]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_ZN6__tsanL21CallUserSignalHandlerEPNS_11ThreadStateEbbiPN11__sanitizer23__sanitizer_siginfo_padEPv+0x104 [0x10570f910]
Binaryfile"/opt/homebrew/Cellar/llvm/22.1.5/lib/clang/22/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib", at_Z10sighandleriPN11__sanitizer23__sanitizer_siginfo_padEPv+0x1a8 [0x10570fb68]
Binaryfile"/usr/lib/system/libsystem_platform.dylib", at_sigtramp+0x38 [0x182e257a4]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_EvalFrameDefault+0xc71c [0x104d152e4]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_Vector+0x2d8 [0x104d076ec]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atobject_vacall+0x138 [0x104babb78]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atPyObject_CallFunctionObjArgs+0x38 [0x104babce0]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/Modules/_ssl.cpython-316t-darwin.so", at_servername_callback+0x274 [0x10f9c01c8]
Binaryfile"/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib", atfinal_server_name+0x6c [0x113db4320]
Binaryfile"/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib", attls_parse_all_extensions+0xa8 [0x113db3a10]
Binaryfile"/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib", attls_post_process_client_hello+0x560 [0x113dcf678]
Binaryfile"/opt/homebrew/Cellar/openssl@3/3.6.2/lib/libssl.3.dylib", atstate_machine+0x59c [0x113dbe824]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/Modules/_ssl.cpython-316t-darwin.so", at_ssl__SSLSocket_do_handshake+0x184 [0x10f9c093c]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_EvalFrameDefault+0x4f8c [0x104d0db54]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_Vector+0x2d8 [0x104d076ec]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyObject_VectorcallPrepend+0x144 [0x104bab0c8]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atcontext_run+0x88 [0x104d3b77c]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", atPyObject_Vectorcall+0x58 [0x104ba9a40]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_Py_VectorCallInstrumentation_StackRefSteal+0x12c [0x104d07d10]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_EvalFrameDefault+0x21b4 [0x104d0ad7c]
Binaryfile"/Users/kignatev/PycharmProjects/cpython/python.exe", at_PyEval_Vector+0x2d8 [0x104d076ec]
<truncatedrestofcalls>zsh: abort ./python.exe-mtesttest_ssl-mtest_sni_callback_race

After

0:00:00 load avg: 4.18 [1/1] test_ssl passed

Using Repro:

% ./python.execpython-ft/repros/49.pyfinding: 49SSLContext.sni_callbackreplacementraceexpectedsignal: nativecrash/fatalerror/sanitizeruse-after-freeduringconcurrentSNIhandshakesparameters: seconds=10; Python=3.16.0a0; GIL_enabled=False; workers=28------------------------------------------------------------------------Completedwithoutinterpretercrash: 53271handshakes, 0Python-levelfailures, 245825toggles.

More info

@bedevere-appbedevere-appBot added the tests Tests in the Lib/test dir label May 18, 2026
@python-cla-bot

python-cla-botBot commented May 18, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@kiri11kiri11 changed the title Add test_sni_callback_racegh-149816: Fix SNI callback callable raceMay 18, 2026
@bedevere-appbedevere-appBot mentioned this pull request May 18, 2026
24 tasks
@bedevere-app

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@kiri11
kiri11 marked this pull request as ready for review May 19, 2026 00:17
Comment threadModules/_ssl.c
Comment on lines +5310 to +5323
if (!PyCallable_Check(value)) {
SSL_CTX_set_tlsext_servername_callback(self->ctx, NULL);
}
else {
if (!PyCallable_Check(value)) {
SSL_CTX_set_tlsext_servername_callback(self->ctx, NULL);
PyErr_SetString(PyExc_TypeError,
"not a callable object");
Py_CLEAR(self->set_sni_cb);
if (value != Py_None) {
PyErr_SetString(PyExc_TypeError, "not a callable object");
return -1;
}
self->set_sni_cb = Py_NewRef(value);
SSL_CTX_set_tlsext_servername_callback(self->ctx, _servername_callback);
}
else {
Py_INCREF(value);
PyObject *old_cb = _Py_atomic_exchange_ptr(&self->set_sni_cb, value);
Py_XDECREF(old_cb);
SSL_CTX_set_tlsext_servername_arg(self->ctx, self);
SSL_CTX_set_tlsext_servername_callback(self->ctx, _servername_callback);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look unnecessary if set_sni_cb is always accessed in a critical section.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately just the critical section didn't help (thread sanitizer kept complaining). Probably because it's getting accessed from within ssl library itself, so we can't guard against that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind, I think I got it working

@kiri11
kiri11 requested a review from encukouMay 19, 2026 01:41
@encukouencukou added the needs backport to 3.13 bugs and security fixes label May 19, 2026
@encukouencukou added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels May 19, 2026
@encukou
encukou merged commit 8b31d08 into python:mainMay 19, 2026
61 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @kiri11 for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@github-project-automationgithub-project-automationBot moved this from Todo to Done in SprintMay 19, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @kiri11 and @encukou, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8b31d08e62b9714cf8dd1d8b19afa5ecbad2414a 3.13

@bedevere-app

Copy link
Copy Markdown

GH-150099 is a backport of this pull request to the 3.15 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 19, 2026
@bedevere-app

Copy link
Copy Markdown

GH-150100 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label May 19, 2026
@encukouencukou removed the needs backport to 3.13 bugs and security fixes label May 19, 2026
encukou pushed a commit that referenced this pull request May 19, 2026
(cherry picked from commit 8b31d08)
Co-authored-by: Kirill Ignatev <kiri11@users.noreply.github.com>
serhiy-storchaka pushed a commit that referenced this pull request Jun 8, 2026
(cherry picked from commit 8b31d08)
Co-authored-by: Kirill Ignatev <kiri11@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
@kumaraditya303

kumaraditya303 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR does not fixes the internal data races in openssl, see #150191 (comment) for the details of the race.

For now I have skipped this test under TSAN to keep TSAN CI working but this needs to be either fixed properly or documented as not thread safe as most other ssl operations.

cc @encukou

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sprinttestsTests in the Lib/test dir

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants

@kiri11@kumaraditya303@encukou@cmaloney