Title: Assertion triggered in MiMalloc (free-threaded build) · Issue #153176 · python/cpython · GitHub
Open Graph Title: Assertion triggered in MiMalloc (free-threaded build) · Issue #153176 · python/cpython
X Title: Assertion triggered in MiMalloc (free-threaded build) · Issue #153176 · python/cpython
Description: Bug report Bug description: I noticed that tearing down a subinterpreter's thread state aborts on an assertion. python: Objects/obmalloc.c:215: _PyMem_mi_page_reclaimed: Assertion `tstate == (_PyThreadStateImpl *)_PyThreadState_GET()' fa...
Open Graph Description: Bug report Bug description: I noticed that tearing down a subinterpreter's thread state aborts on an assertion. python: Objects/obmalloc.c:215: _PyMem_mi_page_reclaimed: Assertion `tstate == (_PyTh...
X Description: Bug report Bug description: I noticed that tearing down a subinterpreter's thread state aborts on an assertion. python: Objects/obmalloc.c:215: _PyMem_mi_page_reclaimed: Assertion `tstate == (_...
Opengraph URL: https://github.com/python/cpython/issues/153176
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Assertion triggered in MiMalloc (free-threaded build)","articleBody":"# Bug report\n\n### Bug description:\n\nI noticed that tearing down a subinterpreter's thread state aborts on an assertion.\n```\npython: Objects/obmalloc.c:215: _PyMem_mi_page_reclaimed: Assertion `tstate == (_PyThreadStateImpl *)_PyThreadState_GET()' failed.\nfish: Job 1, './python xxxxx' terminated by signal SIGABRT (Abort)\n```\nThis can be easily reproduced on a free-threaded debug build by running:\n```\nimport _testinternalcapi\n\ninterpid = _testinternalcapi.create_interpreter()\n_testinternalcapi.destroy_interpreter(interpid, basic=True)\n```\n\n### Some Investigation\nThis assertion was added in #145626 . Interestingly, the author @colesbury said in the PR:\n\n> In `_PyMem_mi_page_maybe_free()`, use the page's heap tld to find the correct thread state ...... so the current thread state is not necessarily the owner of the page.\n\nSince `_PyMem_mi_page_maybe_free()` doesn't assume the page owner to be current thread, maybe that's the same for `_PyMem_mi_page_reclaimed` ?\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-153307\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/weixlu","@type":"Person","name":"weixlu"},"datePublished":"2026-07-06T07:48:48Z","url":"https://github.com/python/cpython/issues/153176"}
| 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:17289d41-f88e-5330-9475-6972278a7b56 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9CB2:158DF1:16A8EE2:1DEB6E6:6B020111 |
| html-safe-nonce | 01ecc9d0693f4240c005fc378ea7d04f81943c300660650cbe3f6354c932659b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0IyOjE1OERGMToxNkE4RUUyOjFERUI2RTY6NkIwMjAxMTEiLCJ2aXNpdG9yX2lkIjoiMzc2MjQyNDczNzg3MjA4NTI2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3d7f502b1bf261bafb98b65b3e52313169d6d0d3f5e40b5100956c2553c093d0 |
| hovercard-subject-tag | issue:4817070822 |
| 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/153176/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e420edd7bb4eb16a4f9c0690cdd17e51a37ed4043dfd6a71155e2fe6f0220191/python/cpython/issues/153176 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e420edd7bb4eb16a4f9c0690cdd17e51a37ed4043dfd6a71155e2fe6f0220191/python/cpython/issues/153176 |
| og:image:alt | Bug report Bug description: I noticed that tearing down a subinterpreter's thread state aborts on an assertion. python: Objects/obmalloc.c:215: _PyMem_mi_page_reclaimed: Assertion `tstate == (_PyTh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | weixlu |
| 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