Title: segfault in gc with 3.14.0b1, trio and pytest · Issue #133932 · python/cpython · GitHub
Open Graph Title: segfault in gc with 3.14.0b1, trio and pytest · Issue #133932 · python/cpython
X Title: segfault in gc with 3.14.0b1, trio and pytest · Issue #133932 · python/cpython
Description: Crash report What happened? I'm encountering a segfault during garbage collection since 3.14.0b1 (I have not been able to reproduce it on 3.14.0a6), and while I've so far been able to minify the repro somewhat it still requires both pyte...
Open Graph Description: Crash report What happened? I'm encountering a segfault during garbage collection since 3.14.0b1 (I have not been able to reproduce it on 3.14.0a6), and while I've so far been able to minify the re...
X Description: Crash report What happened? I'm encountering a segfault during garbage collection since 3.14.0b1 (I have not been able to reproduce it on 3.14.0a6), and while I've so far been able to minif...
Opengraph URL: https://github.com/python/cpython/issues/133932
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"segfault in gc with 3.14.0b1, trio and pytest","articleBody":"# Crash report\n\n### What happened?\n\nI'm encountering a segfault during garbage collection since 3.14.0b1 (I have not been able to reproduce it on 3.14.0a6), and while I've so far been able to minify the repro somewhat it still requires both pytest and trio\n\n```python\nimport trio\nfrom contextlib import suppress\nimport gc\n\ndef test_error_in_run_loop() -\u003e None:\n # Blow stuff up real good to check we at least get a TrioInternalError\n async def main() -\u003e None:\n task = trio.lowlevel.current_task()\n task._schedule_points = \"hello!\" # type: ignore\n await trio.lowlevel.checkpoint()\n with suppress(trio.TrioInternalError):\n trio.run(main)\n gc.collect()\n gc.collect() # removing this line makes the segfault disappear\n```\n\n```\n$ tox -e repro_crash\n===================================== test session starts =====================================\nplatform linux -- Python 3.14.0b1, pytest-8.3.5, pluggy-1.5.0\ncachedir: .tox/crash/.pytest_cache\nrootdir: /home/h/Git/trio/unbreak_314\nconfigfile: pyproject.toml\ncollected 1 item \n\nFatal Python error: Segmentation fault\n\nCurrent thread 0x00007fc3244b0bc0 [pytest] (most recent call first):\n Garbage-collecting\n File \"./foo.py\", line 14 in test_error_in_run_loop\n File \".../site-packages/_pytest/python.py\", line 159 in pytest_pyfunc_call\n File \".../site-packages/pluggy/_callers.py\", line 103 in _multicall\n File \".../site-packages/pluggy/_manager.py\", line 120 in _hookexec\n File \".../site-packages/pluggy/_hooks.py\", line 513 in __call__\n File \".../site-packages/_pytest/python.py\", line 1627 in runtest\n File \".../site-packages/_pytest/runner.py\", line 174 in pytest_runtest_call\n File \".../site-packages/pluggy/_callers.py\", line 103 in _multicall\n File \".../site-packages/pluggy/_manager.py\", line 120 in _hookexec\n File \".../site-packages/pluggy/_hooks.py\", line 513 in __call__\n File \".../site-packages/_pytest/runner.py\", line 242 in \u003clambda\u003e\n File \".../site-packages/_pytest/runner.py\", line 341 in from_call\n File \".../site-packages/_pytest/runner.py\", line 241 in call_and_report\n File \".../site-packages/_pytest/runner.py\", line 132 in runtestprotocol\n File \".../site-packages/_pytest/runner.py\", line 113 in pytest_runtest_protocol\n File \".../site-packages/pluggy/_callers.py\", line 103 in _multicall\n File \".../site-packages/pluggy/_manager.py\", line 120 in _hookexec\n File \".../site-packages/pluggy/_hooks.py\", line 513 in __call__\n File \".../site-packages/_pytest/main.py\", line 362 in pytest_runtestloop\n File \".../site-packages/pluggy/_callers.py\", line 103 in _multicall\n File \".../site-packages/pluggy/_manager.py\", line 120 in _hookexec\n File \".../site-packages/pluggy/_hooks.py\", line 513 in __call__\n File \".../site-packages/_pytest/main.py\", line 337 in _main\n File \".../site-packages/_pytest/main.py\", line 283 in wrap_session\n File \".../site-packages/_pytest/main.py\", line 330 in pytest_cmdline_main\n File \".../site-packages/pluggy/_callers.py\", line 103 in _multicall\n File \".../site-packages/pluggy/_manager.py\", line 120 in _hookexec\n File \".../site-packages/pluggy/_hooks.py\", line 513 in __call__\n File \".../site-packages/_pytest/config/__init__.py\", line 175 in main\n File \".../site-packages/_pytest/config/__init__.py\", line 201 in console_main\n File \"./.tox/crash/bin/pytest\", line 10 in \u003cmodule\u003e\n\nCurrent thread's C stack trace (most recent call first):\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at _Py_DumpStack+0x4d [0x7fc324096a8d]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x2a778c [0x7fc3240a778c]\n Binary file \"/usr/lib/libc.so.6\", at +0x3dcd0 [0x7fc323c4bcd0]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x23a40a [0x7fc32403a40a]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0xd8d80 [0x7fc323ed8d80]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at _Py_Dealloc+0x75 [0x7fc323f21745]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x1436c1 [0x7fc323f436c1]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x143e65 [0x7fc323f43e65]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x2379db [0x7fc3240379db]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x237e6c [0x7fc324037e6c]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x2a4df8 [0x7fc3240a4df8]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at PyObject_Vectorcall+0x5d [0x7fc323ebbc4d]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at _PyEval_EvalFrameDefault+0x13ba [0x7fc323fef17a]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x201237 [0x7fc324001237]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0xbb926 [0x7fc323ebb926]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0xbbbc0 [0x7fc323ebbbc0]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x1437c9 [0x7fc323f437c9]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at _PyObject_MakeTpCall+0x9f [0x7fc323ebb52f]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at _PyEval_EvalFrameDefault+0x4bbf [0x7fc323ff297f]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x201237 [0x7fc324001237]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0xbb926 [0x7fc323ebb926]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0xbbbc0 [0x7fc323ebbbc0]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x1437c9 [0x7fc323f437c9]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0xbb231 [0x7fc323ebb231]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at _PyEval_EvalFrameDefault+0x1cae [0x7fc323fefa6e]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x201237 [0x7fc324001237]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0xbb926 [0x7fc323ebb926]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0xbbbc0 [0x7fc323ebbbc0]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x1437c9 [0x7fc323f437c9]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at _PyObject_MakeTpCall+0x9f [0x7fc323ebb52f]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at _PyEval_EvalFrameDefault+0x4bbf [0x7fc323ff297f]\n Binary file \"/usr/lib/libpython3.14.so.1.0\", at +0x201237 [0x7fc324001237]\n \u003ctruncated rest of calls\u003e\nfoo.py crash: exit -11 (1.06 seconds) .\u003e pytest foo.py pid=781607\n crash: FAIL code -11 (2.11 seconds)\n evaluation failed :( (2.22 seconds)\n```\n\nI also reproduced it in a clean 3.14.0b1 venv with trio==0.30.0; pytest==8.3.5 without relying on tox, but idr how to get it to print the stack trace that way.\n\nIt's not 100% reliable, so I suspect there's some thread race condition going on.\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.14.0b1 (main, May 9 2025, 13:04:07) [GCC 14.2.1 20250207]\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-134244\n* gh-134494\n* gh-142431\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/jakkdl","@type":"Person","name":"jakkdl"},"datePublished":"2025-05-12T14:31:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/133932/cpython/issues/133932"}
| 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:9b5d341d-c366-b238-2e00-c42d28a850a4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B214:3F035C:5D6C47B:7EDD4FF:696E2C09 |
| html-safe-nonce | 80e52134c25bab4949a3915aeedd675c332290a3e4f7c9ceceb8baad4370be76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjE0OjNGMDM1Qzo1RDZDNDdCOjdFREQ0RkY6Njk2RTJDMDkiLCJ2aXNpdG9yX2lkIjoiNzQyODY3Njk3ODU0NzIzOTk0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3556e5e14d3e4dc152fc96b650af19e5725075a7fb7dde6abf1db07ba9f420f2 |
| hovercard-subject-tag | issue:3057191294 |
| 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/133932/issue_layout |
| twitter:image | https://opengraph.githubassets.com/08c85ed7c4b321e1b2dd234efa350a0dc95adad0a1d224ab373c6afbe9baa143/python/cpython/issues/133932 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/08c85ed7c4b321e1b2dd234efa350a0dc95adad0a1d224ab373c6afbe9baa143/python/cpython/issues/133932 |
| og:image:alt | Crash report What happened? I'm encountering a segfault during garbage collection since 3.14.0b1 (I have not been able to reproduce it on 3.14.0a6), and while I've so far been able to minify the re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jakkdl |
| hostname | github.com |
| expected-hostname | github.com |
| None | 878b142339d396b81902fd0c6d3f2f41511e1864f596c5a601660d91d0d60e59 |
| 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 | 20fb42f07915f87665e5bccffc415f231d50cfac |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width