-
-
Notifications
You must be signed in to change notification settings - Fork 32k
segfault in gc with 3.14.0b1, trio and pytest #133932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
3.14
bugs and security fixes
3.15
new features, bugs and security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-crash
A hard crash of the interpreter, possibly with a core dump
Comments
Here's the backtrace I get on 3.14 latest git: Program received signal SIGSEGV, Segmentation fault.
PyStackRef_IsHeapSafe (ref=...) at ./Include/internal/pycore_stackref.h:609
609 return (ref.bits & Py_TAG_BITS) == 0 || ref.bits == PyStackRef_NULL_BITS || _Py_IsImmortal(BITS_TO_PTR_MASKED(ref));
#0 PyStackRef_IsHeapSafe (ref=...) at ./Include/internal/pycore_stackref.h:609
#1 PyStackRef_MakeHeapSafe (ref=...) at ./Include/internal/pycore_stackref.h:615
#2 _PyFrame_Copy (dest=0x7ffff5fc0868, src=0x7ffff5fc0718) at ./Include/internal/pycore_interpframe.h:98
#3 take_ownership (frame=0x7ffff5fc0718, f=0x7ffff5fc0820) at Python/frame.c:54
#4 _PyFrame_ClearExceptCode (frame=frame@entry=0x7ffff5fc0718) at Python/frame.c:120
#5 0x000055555566b9d5 in gen_clear_frame (gen=0x7ffff5fc06d0) at Objects/genobject.c:153
#6 gen_clear_frame (gen=0x7ffff5fc06d0) at Objects/genobject.c:145
#7 gen_dealloc (self=0x7ffff5fc06d0) at Objects/genobject.c:182
#8 0x00005555556bd3ae in _Py_Dealloc (op=0x7ffff5fc06d0) at Objects/object.c:3107
#9 0x00005555556eeabe in Py_DECREF (op=<optimized out>) at ./Include/refcount.h:433
#10 clear_slots (self=0x7ffff5fbf800, type=0x555556268f50) at Objects/typeobject.c:2465
#11 subtype_clear (self=0x7ffff5fbf800) at Objects/typeobject.c:2483
#12 0x00005555557eac73 in delete_garbage (old=0x555555b01c60 <_PyRuntime+98048>, collectable=0x7fffffffd9d0,
gcstate=<optimized out>, tstate=0x555555b36da0 <_PyRuntime+315456>) at Python/gc.c:1141
#13 gc_collect_region (tstate=tstate@entry=0x555555b36da0 <_PyRuntime+315456>, from=<optimized out>,
to=0x555555b01c60 <_PyRuntime+98048>, stats=stats@entry=0x7fffffffdad0) at Python/gc.c:1759
#14 0x00005555557ebc6c in gc_collect_full (stats=0x7fffffffdad0, tstate=0x555555b36da0 <_PyRuntime+315456>) at Python/gc.c:1679
#15 _PyGC_Collect (tstate=0x555555b36da0 <_PyRuntime+315456>, generation=generation@entry=2,
reason=reason@entry=_Py_GC_REASON_MANUAL) at Python/gc.c:2041
#16 0x00005555557ed5ae in PyGC_Collect () at Python/gc.c:2070
#17 0x0000555555827526 in _Py_Finalize (runtime=0x555555ae9d60 <_PyRuntime>) at Python/pylifecycle.c:2121
#18 0x000055555582791d in _Py_Finalize (runtime=0x555555ae9d60 <_PyRuntime>) at Python/pylifecycle.c:2252
#19 0x000055555585f8ff in Py_RunMain () at Modules/main.c:769
#20 pymain_main (args=0x7fffffffdc40) at Modules/main.c:797
#21 Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:821
#22 0x00007ffff7cc7d90 in __libc_start_call_main (main=main@entry=0x5555555d9cc0 <main>, argc=argc@entry=4,
argv=argv@entry=0x7fffffffddc8) at ../sysdeps/nptl/libc_start_call_main.h:58
#23 0x00007ffff7cc7e40 in __libc_start_main_impl (main=0x5555555d9cc0 <main>, argc=4, argv=0x7fffffffddc8, init=<optimized out>,
fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffddb8) at ../csu/libc-start.c:392
#24 0x00005555555ec365 in _start () |
This bisects to ccf1b0b cc @markshannon |
4 tasks
markshannon
added a commit
that referenced
this issue
May 22, 2025
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 22, 2025
(cherry picked from commit 29f6dc6) Co-authored-by: Mark Shannon <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.14
bugs and security fixes
3.15
new features, bugs and security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-crash
A hard crash of the interpreter, possibly with a core dump
Uh oh!
There was an error while loading. Please reload this page.
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 pytest and trio
I 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.
It's not 100% reliable, so I suspect there's some thread race condition going on.
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0b1 (main, May 9 2025, 13:04:07) [GCC 14.2.1 20250207]
Linked PRs
The text was updated successfully, but these errors were encountered: