Title: `tracemalloc` aborts when run from threads in no-gil · Issue #126315 · python/cpython · GitHub
Open Graph Title: `tracemalloc` aborts when run from threads in no-gil · Issue #126315 · python/cpython
X Title: `tracemalloc` aborts when run from threads in no-gil · Issue #126315 · python/cpython
Description: Crash report What happened? It's possible to get two different aborts from failed assertions, only with PYTHON_GIL=0, using the code below: from threading import Thread import _tracemalloc alive = [ Thread(target=_tracemalloc.start, args...
Open Graph Description: Crash report What happened? It's possible to get two different aborts from failed assertions, only with PYTHON_GIL=0, using the code below: from threading import Thread import _tracemalloc alive = ...
X Description: Crash report What happened? It's possible to get two different aborts from failed assertions, only with PYTHON_GIL=0, using the code below: from threading import Thread import _tracemalloc aliv...
Opengraph URL: https://github.com/python/cpython/issues/126315
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`tracemalloc` aborts when run from threads in no-gil","articleBody":"# Crash report\n\n### What happened?\n\nIt's possible to get two different aborts from failed assertions, only with `PYTHON_GIL=0`, using the code below:\n\n```python\nfrom threading import Thread\nimport _tracemalloc\n\nalive = [\n Thread(target=_tracemalloc.start, args=(\n (memoryview(bytearray(b\"abc\\xe9\\xff\")),))),\n Thread(target=_tracemalloc.start, args=()),\n Thread(target=_tracemalloc.get_traceback_limit, args=()),\n Thread(target=_tracemalloc.start, args=()),\n Thread(target=_tracemalloc.stop, args=()),\n Thread(target=_tracemalloc.reset_peak, args=()),\n Thread(target=_tracemalloc.get_tracemalloc_memory, args=())\n]\n\nfor obj in alive:\n print('START', obj)\n try:\n obj.start()\n except Exception:\n pass\n```\n\nThe errors are:\n```\npython: Python/tracemalloc.c:445: tracemalloc_remove_trace: Assertion `tracemalloc_config.tracing' failed.\nAborted\n```\nAnd:\n```\npython: Python/tracemalloc.c:469: tracemalloc_add_trace: Assertion `tracemalloc_config.tracing' failed.\nAborted\n```\nFound with fusil by @vstinner.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.14.0a1+ experimental free-threading build (heads/main:d467d9246c, Nov 1 2024, 09:05:56) [GCC 11.4.0]","author":{"url":"https://github.com/devdanzin","@type":"Person","name":"devdanzin"},"datePublished":"2024-11-01T23:27:30Z","url":"https://github.com/python/cpython/issues/126315"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:178f2881-4092-d843-aa46-2cea88d4924b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95DC:24645:1342D9E:1970D1A:6B01EE10 |
| html-safe-nonce | b7d408315cb5ecd77e5f87336ae564e387121e946c4cf4d2aac5e0e9c23591b3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NURDOjI0NjQ1OjEzNDJEOUU6MTk3MEQxQTo2QjAxRUUxMCIsInZpc2l0b3JfaWQiOiI3Njk3ODQzODUwMzI0MzQwMjQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f62e642e28060a74962450c8285af3bacef2d0092973f57a584034fccba40452 |
| hovercard-subject-tag | issue:2630013668 |
| 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/126315/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4f32ef53bb527fe690c70e0dd81b7684e581e2dc6433b8c39401404297acc00a/python/cpython/issues/126315 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4f32ef53bb527fe690c70e0dd81b7684e581e2dc6433b8c39401404297acc00a/python/cpython/issues/126315 |
| og:image:alt | Crash report What happened? It's possible to get two different aborts from failed assertions, only with PYTHON_GIL=0, using the code below: from threading import Thread import _tracemalloc alive = ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | devdanzin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width