Title: gh-127421: Fix race in test_start_new_thread_failed by mpage · Pull Request #127549 · python/cpython · GitHub
Open Graph Title: gh-127421: Fix race in test_start_new_thread_failed by mpage · Pull Request #127549 · python/cpython
X Title: gh-127421: Fix race in test_start_new_thread_failed by mpage · Pull Request #127549 · python/cpython
Description: When we succeed in starting a new thread, for example if setrlimit was ineffective, we must wait for the newly spawned thread to exit. Otherwise, we run the risk that the newly spawned thread will race with runtime finalization and access memory that has already been freed. In this case, this assertion tends to fire: cpython/Python/pystate.c Line 322 in dffb909 assert(tstate_is_alive(tstate)); when the newly created thread attempts to bind the state after the runtime has been finalized, because all thread states are cleared and deleted as part of finalization. The use of _thread.start_new_thread() is problematic here. It only spawns daemon threads, which the runtime does not wait for during finalization, and does not return a joinable handle. Instead, use _thread.start_joinable_thread() and join the resulting handle when the thread is started successfully. Issue: gh-127421
Open Graph Description: When we succeed in starting a new thread, for example if setrlimit was ineffective, we must wait for the newly spawned thread to exit. Otherwise, we run the risk that the newly spawned thread will ...
X Description: When we succeed in starting a new thread, for example if setrlimit was ineffective, we must wait for the newly spawned thread to exit. Otherwise, we run the risk that the newly spawned thread will ...
Opengraph URL: https://github.com/python/cpython/pull/127549
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:56471b4b-bf79-b092-a1ca-84733d737ecd |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | ED44:B0EAE:88BB42:C29992:6A5792E1 |
| html-safe-nonce | d6066f68657cad409f28500c78a0c7bf8916615a2022ab681fe3dc3b19ac30d3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDQ0OkIwRUFFOjg4QkI0MjpDMjk5OTI6NkE1NzkyRTEiLCJ2aXNpdG9yX2lkIjoiNzIxNjA0NjEyMjgzMzc3NzM3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 83d24f846400a14cadbe311d7dd3415b59bed846bee448d3f4c97a744cbd46c4 |
| hovercard-subject-tag | pull_request:2211946296 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/127549/files |
| twitter:image | https://avatars.githubusercontent.com/u/577841?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/577841?s=400&v=4 |
| og:image:alt | When we succeed in starting a new thread, for example if setrlimit was ineffective, we must wait for the newly spawned thread to exit. Otherwise, we run the risk that the newly spawned thread will ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a87fc68e9bdf22e1c7e48ac6a60b98882f4bb103314b3f26b3460c61fc5441ae |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a2198d0212ed703af207673eb4d0868d4f867a5b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width