| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…mory allocator When new thread is starting, but Python is finalizing, PyMem_Free can't be called on new thread bootstate, because this created thread doesn't own the GIL. We should use raw memory allocator to allocate/free bootstate to avoid crashes/other unexpected behaviour.
|
Windows (x86) failed due to #109739. |
Sorry, something went wrong.
…of github.com:chgnrdv/cpython into _thread-start-new-thread-use-raw-malloc-for-bootstate
Co-authored-by: Victor Stinner <vstinner@python.org>
| @@ -0,0 +1 @@ | |||
| :func:`!_thread.start_new_thread` now uses raw memory allocator to allocate new thread bootstate. This helps to avoid crashes in case when new thread gets started at interpreter finalization. | |||
There was a problem hiding this comment.
Oh. Please remove this Changelog entry. I don't think that it's worth it. It doesn't impact directly users and it's a recent regression, no?
Sorry, something went wrong.
…e-109795.gI7KW6.rst
|
Sorry, @chgnrdv and @vstinner, I could not cleanly backport this to 3.11 due to a conflict. |
Sorry, something went wrong.
…e using raw memory allocator (python#109808) (cherry picked from commit 1b8f236)
|
GH-109852 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
|
Merged, thanks! |
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot aarch64 RHEL8 LTO 3.x has failed when building commit 1b8f236. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/338/builds/5153 Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1004, in exec_module
File "<frozen importlib._bootstrap_external>", line 1100, in get_code
File "<frozen importlib._bootstrap_external>", line 1199, in get_data
TypeError: descriptor 'close' for '_io.BufferedReader' objects doesn't apply to a '_io.FileIO' object
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 1059, in _bootstrap_inner
self.run()
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/threading.py", line 996, in run
self._target(*self._args, **self._kwargs)
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/test/test_interpreters.py", line 483, in task
interp = interpreters.create()
^^^^^^^^^^^^^^^^^^^^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.lto/build/Lib/test/support/interpreters.py", line 25, in create
id = _interpreters.create(isolated=isolated)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: interpreter creation failed
k
|
Sorry, something went wrong.
…e using raw memory allocator (python#109808)
…e using raw memory allocator (python#109808) (cherry picked from commit 1b8f236)
) (#110342) * gh-108987: Fix _thread.start_new_thread() race condition (#109135) Fix _thread.start_new_thread() race condition. If a thread is created during Python finalization, the newly spawned thread now exits immediately instead of trying to access freed memory and lead to a crash. thread_run() calls PyEval_AcquireThread() which checks if the thread must exit. The problem was that tstate was dereferenced earlier in _PyThreadState_Bind() which leads to a crash most of the time. Move _PyThreadState_CheckConsistency() from thread_run() to _PyThreadState_Bind(). (cherry picked from commit 517cd82) * gh-109795: `_thread.start_new_thread`: allocate thread bootstate using raw memory allocator (#109808) (cherry picked from commit 1b8f236) --------- Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
…e using raw memory allocator (python#109808)
| Back | FazBrowse Home | New Git URL |
Fixes #109795
When new thread is starting, but Python is finalizing, PyMem_Free can't be called on new thread bootstate, because this thread doesn't own the GIL. We should use raw memory allocator to allocate/free bootstate to avoid crashes/other unexpected behaviour.