Title: test_audit_subinterpreter crashes with tracerefs enabled · Issue #125286 · python/cpython · GitHub
Open Graph Title: test_audit_subinterpreter crashes with tracerefs enabled · Issue #125286 · python/cpython
X Title: test_audit_subinterpreter crashes with tracerefs enabled · Issue #125286 · python/cpython
Description: Crash report What happened? To run test: Programs/_testembed test_audit_subinterpreter. The program crashes with an assert failure: _testembed: ../Objects/object.c:196: _PyRefchain_Remove: Assertion `value == REFCHAIN_VALUE' failed. Stac...
Open Graph Description: Crash report What happened? To run test: Programs/_testembed test_audit_subinterpreter. The program crashes with an assert failure: _testembed: ../Objects/object.c:196: _PyRefchain_Remove: Assertio...
X Description: Crash report What happened? To run test: Programs/_testembed test_audit_subinterpreter. The program crashes with an assert failure: _testembed: ../Objects/object.c:196: _PyRefchain_Remove: Assertio...
Opengraph URL: https://github.com/python/cpython/issues/125286
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_audit_subinterpreter crashes with tracerefs enabled","articleBody":"# Crash report\n\n### What happened?\n\nTo run test: `Programs/_testembed test_audit_subinterpreter`.\n\nThe program crashes with an assert failure:\n```\n_testembed: ../Objects/object.c:196: _PyRefchain_Remove: Assertion `value == REFCHAIN_VALUE' failed.\n```\n\nStack trace:\n```\n#5 0x00007fbd32045eb2 in __GI___assert_fail (\n assertion=assertion@entry=0x55f8c78ecded \"value == REFCHAIN_VALUE\", \n file=file@entry=0x55f8c78ecd93 \"../Objects/object.c\", line=line@entry=196, \n function=function@entry=0x55f8c78edba0 \u003c__PRETTY_FUNCTION__.13\u003e \"_PyRefchain_Remove\")\n at ./assert/assert.c:101\n#6 0x000055f8c76c9999 in _PyRefchain_Remove (interp=\u003coptimized out\u003e, obj=obj@entry=0x7fbd3183d710)\n at ../Objects/object.c:196\n#7 0x000055f8c76cb6c3 in _Py_ForgetReference (op=op@entry=0x7fbd3183d710) at ../Objects/object.c:2548\n#8 0x000055f8c76ca91d in _Py_Dealloc (op=op@entry=0x7fbd3183d710) at ../Objects/object.c:2923\n#9 0x000055f8c76b2ad4 in Py_DECREF (filename=filename@entry=0x55f8c78b4f72 \"../Include/refcount.h\", \n lineno=lineno@entry=476, op=0x7fbd3183d710) at ../Include/refcount.h:367\n#10 0x000055f8c76b2af3 in Py_XDECREF (op=\u003coptimized out\u003e) at ../Include/refcount.h:476\n#11 0x000055f8c76b2c0f in dictkeys_decref (interp=interp@entry=0x7fbd31f6e020, \n dk=dk@entry=0x55f8c9b29030, use_qsbr=use_qsbr@entry=false) at ../Objects/dictobject.c:459\n#12 0x000055f8c76bca24 in dict_dealloc (self=0x7fbd31765070) at ../Objects/dictobject.c:3187\n#13 0x000055f8c76ca923 in _Py_Dealloc (op=op@entry=0x7fbd31765070) at ../Objects/object.c:2925\n#14 0x000055f8c76c67ab in Py_DECREF (\n filename=filename@entry=0x55f8c78ec613 \"../Objects/moduleobject.c\", lineno=lineno@entry=1118, \n op=0x7fbd31765070) at ../Include/refcount.h:367\n#15 0x000055f8c76c6bdb in module_clear (self=0x7fbd31764110) at ../Objects/moduleobject.c:1118\n#16 0x000055f8c77e604a in delete_garbage (tstate=tstate@entry=0x7fbd31fa4d18, \n gcstate=gcstate@entry=0x7fbd31f6fd08, collectable=collectable@entry=0x7ffd93cac500, \n old=old@entry=0x7fbd31f6fd50) at ../Python/gc.c:1126\n#17 0x000055f8c77e62f7 in gc_collect_region (tstate=tstate@entry=0x7fbd31fa4d18, \n from=from@entry=0x7fbd31f6fd50, to=to@entry=0x7fbd31f6fd50, untrack=untrack@entry=3, \n stats=stats@entry=0x7ffd93cac5e0) at ../Python/gc.c:1585\n#18 0x000055f8c77e6790 in gc_collect_full (tstate=tstate@entry=0x7fbd31fa4d18, \n stats=stats@entry=0x7ffd93cac5e0) at ../Python/gc.c:1498\n#19 0x000055f8c77e7070 in _PyGC_Collect (tstate=0x7fbd31fa4d18, generation=generation@entry=2, \n reason=reason@entry=_Py_GC_REASON_SHUTDOWN) at ../Python/gc.c:1862\n#20 0x000055f8c77e70ce in _PyGC_CollectNoFail (tstate=tstate@entry=0x7fbd31fa4d18)\n at ../Python/gc.c:1903\n#21 0x000055f8c7818408 in finalize_modules (tstate=tstate@entry=0x7fbd31fa4d18)\n at ../Python/pylifecycle.c:1716\n#22 0x000055f8c781e9f4 in Py_EndInterpreter (tstate=tstate@entry=0x7fbd31fa4d18)\n at ../Python/pylifecycle.c:2409\n#23 0x000055f8c781ec3a in finalize_subinterpreters () at ../Python/pylifecycle.c:2484\n#24 0x000055f8c781edc3 in _Py_Finalize (runtime=runtime@entry=0x55f8c7b1e000 \u003c_PyRuntime\u003e)\n at ../Python/pylifecycle.c:2088\n#25 0x000055f8c781ef34 in Py_Finalize () at ../Python/pylifecycle.c:2216\n#26 0x000055f8c75e90ec in test_audit_subinterpreter () at ../Programs/_testembed.c:1431\n#27 0x000055f8c75ece41 in main (argc=\u003coptimized out\u003e, argv=0x7ffd93cac888)\n at ../Programs/_testembed.c:2520\n```\n\nThe object is a string that has been interned but not immortalized. Likely it is shared between sub-interpreters, using basic single-phase init and is therefore shared between multiple sub-interpreters.\n\n```\n(rr) p *op\n$3 = {{ob_refcnt = 0, ob_refcnt_split = {0, 0}}, ob_type = 0x55f8c7b00c40 \u003cPyUnicode_Type\u003e}\n(rr) p op\n$4 = 'time_ns'\n```\n\nThe value of `_PyRefchain_IsTraced()` is false since it is ref-traced in a different interpreter. \n\nQuick and dirty fix for the crash:\n```\n--- a/Objects/object.c\n+++ b/Objects/object.c\n@@ -2537,6 +2537,13 @@ _Py_ForgetReference(PyObject *op)\n \n PyInterpreterState *interp = _PyInterpreterState_GET();\n \n+ if (!_PyRefchain_IsTraced(interp, op) \u0026\u0026\n+ PyUnicode_Check(op) \u0026\u0026\n+ PyUnicode_CHECK_INTERNED(op) \u0026\u0026\n+ interp != _PyInterpreterState_Main()) {\n+ return;\n+ }\n+\n #ifdef SLOW_UNREF_CHECK\n if (!_PyRefchain_Get(interp, op)) {\n /* Not found */\n```\n\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\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-125314\n* gh-125709\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/nascheme","@type":"Person","name":"nascheme"},"datePublished":"2024-10-10T22:07:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/125286/cpython/issues/125286"}
| 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:5dec8297-2f22-4a35-2d45-9885844b3d02 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DEFA:385F9F:119D23C:184C342:696A9AA4 |
| html-safe-nonce | 4b88a551bee36f9ba383060071baaa2b5260a1288acece6e5a39ed28f807fd4c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERUZBOjM4NUY5RjoxMTlEMjNDOjE4NEMzNDI6Njk2QTlBQTQiLCJ2aXNpdG9yX2lkIjoiMzkyNDc5NjY2Nzk2MDQwMDU0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 00323cf677036ecb8835b8abe9b8fd271fc49e21ffc20153dde5bbf10f4cd13c |
| hovercard-subject-tag | issue:2579941882 |
| 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/125286/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7cd864b99306a90af315c7c7fb37d4d4aa9d62a0b1c6a40548cd6995b98982e5/python/cpython/issues/125286 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7cd864b99306a90af315c7c7fb37d4d4aa9d62a0b1c6a40548cd6995b98982e5/python/cpython/issues/125286 |
| og:image:alt | Crash report What happened? To run test: Programs/_testembed test_audit_subinterpreter. The program crashes with an assert failure: _testembed: ../Objects/object.c:196: _PyRefchain_Remove: Assertio... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nascheme |
| hostname | github.com |
| expected-hostname | github.com |
| None | c0d8175e41e0e55b9e984c935b24b808cabab919dd3174aa45dac3ef503ed1af |
| 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 | 99aab454e5ddc8df30805fb76c114c3008a15842 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width