Title: Various data races in subinterpreter tests under TSAN · Issue #129824 · python/cpython · GitHub
Open Graph Title: Various data races in subinterpreter tests under TSAN · Issue #129824 · python/cpython
X Title: Various data races in subinterpreter tests under TSAN · Issue #129824 · python/cpython
Description: Bug report Thread sanitizer reports a number of data races when running subinterpreter tests InterpreterPoolMixin (test_concurrent_futures) run_eval_code_obj: see #128130 posixmodule_exec modifies globals waitid_result_desc and stat_resu...
Open Graph Description: Bug report Thread sanitizer reports a number of data races when running subinterpreter tests InterpreterPoolMixin (test_concurrent_futures) run_eval_code_obj: see #128130 posixmodule_exec modifies ...
X Description: Bug report Thread sanitizer reports a number of data races when running subinterpreter tests InterpreterPoolMixin (test_concurrent_futures) run_eval_code_obj: see #128130 posixmodule_exec modifies ...
Opengraph URL: https://github.com/python/cpython/issues/129824
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Various data races in subinterpreter tests under TSAN","articleBody":"# Bug report\n\nThread sanitizer reports a number of data races when running subinterpreter tests\n\n### `InterpreterPoolMixin` (`test_concurrent_futures`)\n\n- [ ] `run_eval_code_obj`: see https://github.com/python/cpython/issues/128130\n- [ ] [`posixmodule_exec`](https://github.com/python/cpython/blob/49bd47d5f14993d37b97aa2bbf257f5df16b96a9/Modules/posixmodule.c#L18014) modifies globals `waitid_result_desc` and `stat_result_desc`\n- [x] `_PyBuiltins_AddExceptions`: modifies globals `PyExc_EnvironmentError`, etc. https://github.com/python/cpython/blob/49bd47d5f14993d37b97aa2bbf257f5df16b96a9/Objects/exceptions.c#L4354-L4355\n- [ ] `_PyInterpreterState_FinalizeAllocatedBlocks`: modifies _PyRuntime variable _PyInterpreterState_FinalizeAllocatedBlocks\n- [ ] `_globals_fini` + [`clear_interpreter`](https://github.com/python/cpython/blob/49bd47d5f14993d37b97aa2bbf257f5df16b96a9/Modules/_interpqueuesmodule.c#L1454-L1456): data race on `_globals.module_count` (the read in `clear_interpreter` happens outside of a lock)\n- [ ] `init_static_exctypes`: modifies globals `_PyExc_InterpreterError`, etc.\n- [ ] `_structmodule_exec`: data race reported on [`ptr-\u003eunpack = native-\u003eunpack`](https://github.com/python/cpython/blob/49bd47d5f14993d37b97aa2bbf257f5df16b96a9/Modules/_struct.c#L2815)\n\nI think for now it would make sense to skip the `InterpreterPoolMixin` tests when running with TSAN.\n\n### `test__interpchannels`\n\n- [ ] [`find_name_in_mro`](https://github.com/python/cpython/blob/7b2e01bb555359913939d7ff168363f1760d3f8e/Objects/typeobject.c#L5415) and [`_waiting_release`](https://github.com/python/cpython/blob/7b2e01bb555359913939d7ff168363f1760d3f8e/Modules/_interpchannelsmodule.c#L497): I don't understand this one, but it happens during `test_send_recv_different_interpreters_and_threads`\n\n### `test__interpreters` and `test_interpreters`\n\n- [ ] `type_ready_set_new`: https://github.com/python/cpython/blob/7b2e01bb555359913939d7ff168363f1760d3f8e/Objects/typeobject.c#L8509\n- [ ] `type_ready`: (see https://github.com/python/cpython/issues/129817)\n- [ ] File descriptor race in `test_api.LowLevelTests.test_is_running` and `test_running`: `close()` concurrent with `read()` on the same file descriptor.\n- [ ] `managed_static_type_state_init` in `test.test_interpreters.test_stress.StressTests.test_create_many_threaded`: data race on the non-atomic read of `interp_count`.\n- [x] pegen [`memo_statistics`](https://github.com/python/cpython/blob/5fa7e1b7fd57e8c6297e9eb79d79cede42e5ce0f/Parser/pegen.c#L367) mutex is currently only used in free threading build (seen in test_create_many_threaded) \n- [x] version tags on static types: `NEXT_GLOBAL_VERSION_TAG`, `type-\u003etp_versions_used`, and `tp-\u003etp_version_tag` modifications are not thread-safe (seen in test_create_many_threaded)\n\n### `test_capi.test_misc.assign_version_tag`\n\n- [x] race on `NEXT_GLOBAL_VERSION_TAG` in `assign_version_tag` (see above)\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-129826\n* gh-129829\n* gh-135794\n* gh-136266\n* gh-143446\n* gh-143530\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/colesbury","@type":"Person","name":"colesbury"},"datePublished":"2025-02-07T18:44:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/129824/cpython/issues/129824"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ee7b0e37-a284-5e3d-7a04-aa2d242e6827 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED98:D9031:FDA2C:146B94:696B350C |
| html-safe-nonce | 4aaf0309754eee6d38a6800ba8d78e8045c33e9458cd042380882392d4997da5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDk4OkQ5MDMxOkZEQTJDOjE0NkI5NDo2OTZCMzUwQyIsInZpc2l0b3JfaWQiOiI1OTk0ODA2NzA4MDMyNzEzOTk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c46d5177c6166b0d04709218eb05d2f28e8527a4e70b703bf94a1e58a9e19bc4 |
| hovercard-subject-tag | issue:2838846879 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/129824/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c879869259fa784d5836e1e26cede19206f72b3f6a066a5cfd2e94c4493ef331/python/cpython/issues/129824 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c879869259fa784d5836e1e26cede19206f72b3f6a066a5cfd2e94c4493ef331/python/cpython/issues/129824 |
| og:image:alt | Bug report Thread sanitizer reports a number of data races when running subinterpreter tests InterpreterPoolMixin (test_concurrent_futures) run_eval_code_obj: see #128130 posixmodule_exec modifies ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | colesbury |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| 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 | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width