Title: Check for ref counting bugs in debug mode caused by immortal objects. · Issue #94851 · python/cpython · GitHub
Open Graph Title: Check for ref counting bugs in debug mode caused by immortal objects. · Issue #94851 · python/cpython
X Title: Check for ref counting bugs in debug mode caused by immortal objects. · Issue #94851 · python/cpython
Description: With #90699, the identifiers are statically allocated and are immortal. This makes it easy to make reference counting mistakes as they are not detected and cause negative ref count in _Py_RefTotal. On my machine the reference count is ne...
Open Graph Description: With #90699, the identifiers are statically allocated and are immortal. This makes it easy to make reference counting mistakes as they are not detected and cause negative ref count in _Py_RefTotal....
X Description: With #90699, the identifiers are statically allocated and are immortal. This makes it easy to make reference counting mistakes as they are not detected and cause negative ref count in _Py_RefTotal....
Opengraph URL: https://github.com/python/cpython/issues/94851
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Check for ref counting bugs in debug mode caused by immortal objects.","articleBody":"With https://github.com/python/cpython/issues/90699, the identifiers are statically allocated and are immortal. This makes it easy to make reference counting mistakes as they are not detected and cause negative ref count in `_Py_RefTotal`.\r\n\r\nOn my machine the reference count is negative because of missing incref on `\u0026_Py_STR(empty)`:\r\n\r\n```console\r\n@kumaraditya303 ➜ /workspaces/cpython (main) $ ./python -I -X showrefcount -c pass\r\n[-1 refs, 0 blocks]\r\n```\r\nPR https://github.com/python/cpython/pull/94850 fixes this issue.\r\n\r\n---\r\n\r\nTo make it easy to discover reference counting issue, I propose to after each runtime finalization check that all the static allocated immortal objects have ref count of `999999999` otherwise `_PyObject_Dump` can be used to output the object and abort the process in debug mode and this will help prevent these kinds of issues of \"unstable\" ref count.\r\n\r\ncc @ericsnowcurrently \n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-102684\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/kumaraditya303","@type":"Person","name":"kumaraditya303"},"datePublished":"2022-07-14T10:19:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/94851/cpython/issues/94851"}
| 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:81ea577e-7396-a6c3-4a9c-b175dc6682e9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E31C:65407:284E7F:35C71C:6969A9FD |
| html-safe-nonce | 88651376a56a2e8c37daa068a4d37059f4f2b3e6bba452bd345c1bd3b7376996 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzFDOjY1NDA3OjI4NEU3RjozNUM3MUM6Njk2OUE5RkQiLCJ2aXNpdG9yX2lkIjoiMzI1NDU4Njk3MTU0MjYyODg2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 62eac1f891c5ea97c1be2b87b4f96645c7966d12bcdd95de10918fdccc2f20ac |
| hovercard-subject-tag | issue:1304574248 |
| 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/94851/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c03e77f7a282c57baf6486e463c10cf140a76c6e42c1b5a923fbebd391ebdede/python/cpython/issues/94851 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c03e77f7a282c57baf6486e463c10cf140a76c6e42c1b5a923fbebd391ebdede/python/cpython/issues/94851 |
| og:image:alt | With #90699, the identifiers are statically allocated and are immortal. This makes it easy to make reference counting mistakes as they are not detected and cause negative ref count in _Py_RefTotal.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kumaraditya303 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| 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 | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width