Sitelet https://github.com/python/cpython/issues/140431
Skip to content

Segfault in gc_free_threading.c after PR #140262 with ASAN build and free-threading tests #140431

Description

@ashm-dev

Bug report

Bug description:

Segmentation fault occurs in gc_free_threading.c when running test_asyncio.test_free_threading after PR #140262.

Build configuration:

CC=clang CXX=clang++ ./configure --with-address-sanitizer --with-pydebug --disable-gil && make -j$(nproc)

Reproduction:

./python -X dev -m test -R 3:3 test_asyncio.test_free_threading

The crash occurs intermittently, but is reproducible 100% of the time with -R 3:3 or higher.

Details

Fatal Python error: Segmentation fault

<Cannot show all threads while the GIL is disabled>
Stack (most recent call first):
  File "/home/shamil/oss/cpython/main/Lib/traceback.py", line 302 in __init__
  File "/home/shamil/oss/cpython/main/Lib/traceback.py", line 501 in _extract_from_extended_frame_gen
  File "/home/shamil/oss/cpython/main/Lib/traceback.py", line 462 in extract
  File "/home/shamil/oss/cpython/main/Lib/traceback.py", line 263 in extract_stack
  File "/home/shamil/oss/cpython/main/Lib/test/test_asyncio/test_free_threading.py", line 216 in factory
  File "/home/shamil/oss/cpython/main/Lib/asyncio/base_events.py", line 468 in create_task
  File "/home/shamil/oss/cpython/main/Lib/asyncio/taskgroups.py", line 196 in create_task
  File "/home/shamil/oss/cpython/main/Lib/test/test_asyncio/test_free_threading.py", line 34 in main
  File "/home/shamil/oss/cpython/main/Lib/asyncio/events.py", line 94 in _run
  File "/home/shamil/oss/cpython/main/Lib/asyncio/base_events.py", line 2038 in _run_once
  File "/home/shamil/oss/cpython/main/Lib/asyncio/base_events.py", line 677 in run_forever
  File "/home/shamil/oss/cpython/main/Lib/asyncio/base_events.py", line 706 in run_until_complete
  File "/home/shamil/oss/cpython/main/Lib/asyncio/runners.py", line 127 in run
  File "/home/shamil/oss/cpython/main/Lib/test/test_asyncio/test_free_threading.py", line 52 in runner
  File "/home/shamil/oss/cpython/main/Lib/threading.py", line 1017 in run
  File "/home/shamil/oss/cpython/main/Lib/threading.py", line 1075 in _bootstrap_inner
  File "/home/shamil/oss/cpython/main/Lib/threading.py", line 1037 in _bootstrap

Current thread's C stack trace (most recent call first):
  Binary file "./python", at ___interceptor_backtrace+0x4a [0x5ca5f227b3ea]
  Binary file "./python", at _Py_DumpStack+0x109 [0x5ca5f2aaf979]
  Binary file "./python", at +0xb6cd3e [0x5ca5f2b05d3e]
  Binary file "/lib/x86_64-linux-gnu/libc.so.6", at +0x45f60 [0x735a10e45f60]
  Binary file "./python", at +0x9dd8a5 [0x5ca5f29768a5]
  Binary file "./python", at +0x9ced79 [0x5ca5f2967d79]
  Binary file "./python", at +0x59abb4 [0x5ca5f2533bb4]
  Binary file "./python", at +0x9dcc03 [0x5ca5f2975c03]
  Binary file "./python", at +0x69f99c [0x5ca5f263899c]
  Binary file "./python", at +0x6a05cd [0x5ca5f26395cd]
  Binary file "./python", at +0x9cf324 [0x5ca5f2968324]
  Binary file "./python", at +0x9d5964 [0x5ca5f296e964]
  Binary file "./python", at +0x9d136d [0x5ca5f296a36d]
  Binary file "./python", at _Py_HandlePending+0x165 [0x5ca5f298b4e5]
  Binary file "./python", at _PyEval_EvalFrameDefault+0x15b01 [0x5ca5f2891a01]
  Binary file "./python", at +0x8e2943 [0x5ca5f287b943]
  Binary file "./python", at +0x536686 [0x5ca5f24cf686]
  Binary file "./python", at +0x539653 [0x5ca5f24d2653]
  Binary file "./python", at +0x72dc43 [0x5ca5f26c6c43]
  Binary file "./python", at +0x747a65 [0x5ca5f26e0a65]
  Binary file "./python", at +0x7108f9 [0x5ca5f26a98f9]
  Binary file "./python", at _PyObject_MakeTpCall+0x2a7 [0x5ca5f24cfd57]
  Binary file "./python", at _PyEval_EvalFrameDefault+0x22f3a [0x5ca5f289ee3a]
  Binary file "./python", at +0x8e2943 [0x5ca5f287b943]
  Binary file "./python", at +0x5362c3 [0x5ca5f24cf2c3]
  Binary file "./python", at +0xb5efd1 [0x5ca5f2af7fd1]
  Binary file "./python", at +0xb604db [0x5ca5f2af94db]
  Binary file "./python", at +0x7108f9 [0x5ca5f26a98f9]
  Binary file "./python", at +0x538b88 [0x5ca5f24d1b88]
  Binary file "./python", at _PyEval_EvalFrameDefault+0x21486 [0x5ca5f289d386]
  Binary file "./python", at +0x8e2943 [0x5ca5f287b943]
  Binary file "./python", at +0x542623 [0x5ca5f24db623]
  <truncated rest of calls>
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1410600==ERROR: AddressSanitizer: SEGV on unknown address 0x03e800158628 (pc 0x735a10ea5fed bp 0x6f5a1003c5b0 sp 0x6f5a1003c580 T894)
==1410600==The signal is caused by a READ memory access.
    #0 0x735a10ea5fed in __pthread_kill_implementation nptl/pthread_kill.c:44:76
    #1 0x735a10ea5fed in __pthread_kill_internal nptl/pthread_kill.c:89:10
    #2 0x735a10ea5fed in pthread_kill nptl/pthread_kill.c:100:10
    #3 0x735a10e45e2d in raise signal/../sysdeps/posix/raise.c:26:13
    #4 0x5ca5f2b05da1 in faulthandler_fatal_error /home/shamil/oss/cpython/main/./Modules/faulthandler.c:427:5
    #5 0x735a10e45f5f  (/lib/x86_64-linux-gnu/libc.so.6+0x45f5f) (BuildId: bc071219b774e887d2477b96fa792af74144ff37)
    #6 0x5ca5f29768a4 in gc_has_bit /home/shamil/oss/cpython/main/Python/gc_free_threading.c:161:17
    #7 0x5ca5f29768a4 in gc_is_unreachable /home/shamil/oss/cpython/main/Python/gc_free_threading.c:185:12
    #8 0x5ca5f29768a4 in visit_clear_unreachable /home/shamil/oss/cpython/main/Python/gc_free_threading.c:1027:9
    #9 0x5ca5f2967d78 in _PyGC_VisitStackRef /home/shamil/oss/cpython/main/Python/gc_free_threading.c:1807:9
    #10 0x5ca5f2533bb3 in gen_traverse /home/shamil/oss/cpython/main/Objects/genobject.c:78:9
    #11 0x5ca5f2975c02 in mark_reachable /home/shamil/oss/cpython/main/Python/gc_free_threading.c:1042:13
    #12 0x5ca5f2975c02 in mark_heap_visitor /home/shamil/oss/cpython/main/Python/gc_free_threading.c:1152:13
    #13 0x5ca5f263899b in _mi_heap_area_visit_blocks /home/shamil/oss/cpython/main/Objects/mimalloc/heap.c:630:14
    #14 0x5ca5f26395cc in mi_heap_area_visitor /home/shamil/oss/cpython/main/Objects/mimalloc/heap.c:681:12
    #15 0x5ca5f26395cc in mi_heap_visit_areas_page /home/shamil/oss/cpython/main/Objects/mimalloc/heap.c:661:10
    #16 0x5ca5f26395cc in mi_heap_visit_pages /home/shamil/oss/cpython/main/Objects/mimalloc/heap.c:46:12
    #17 0x5ca5f26395cc in mi_heap_visit_areas /home/shamil/oss/cpython/main/Objects/mimalloc/heap.c:667:10
    #18 0x5ca5f26395cc in mi_heap_visit_blocks /home/shamil/oss/cpython/main/Objects/mimalloc/heap.c:692:10
    #19 0x5ca5f2968323 in gc_visit_heaps_lock_held /home/shamil/oss/cpython/main/Python/gc_free_threading.c:400:14
    #20 0x5ca5f2968323 in gc_visit_heaps /home/shamil/oss/cpython/main/Python/gc_free_threading.c:439:11
    #21 0x5ca5f296e963 in deduce_unreachable_heap /home/shamil/oss/cpython/main/Python/gc_free_threading.c:1449:9
    #22 0x5ca5f296e963 in gc_collect_internal /home/shamil/oss/cpython/main/Python/gc_free_threading.c:2267:15
    #23 0x5ca5f296a36c in gc_collect_main /home/shamil/oss/cpython/main/Python/gc_free_threading.c:2394:5
    #24 0x5ca5f298b4e4 in _Py_HandlePending /home/shamil/oss/cpython/main/Python/ceval_gil.c:1395:9
    #25 0x5ca5f2891a00 in check_periodics /home/shamil/oss/cpython/main/Python/ceval_macros.h:412:16
    #26 0x5ca5f2891a00 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:10296:31
    #27 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #28 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #29 0x5ca5f24cf685 in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:146:15
    #30 0x5ca5f24d2652 in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24
    #31 0x5ca5f26c6c42 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19
    #32 0x5ca5f26e0a64 in slot_tp_init /home/shamil/oss/cpython/main/Objects/typeobject.c:10829:21
    #33 0x5ca5f26a98f8 in type_call /home/shamil/oss/cpython/main/Objects/typeobject.c:2460:19
    #34 0x5ca5f24cfd56 in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18
    #35 0x5ca5f289ee39 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:3188:35
    #36 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #37 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #38 0x5ca5f24cf2c2 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #39 0x5ca5f2af7fd0 in future_init /home/shamil/oss/cpython/main/./Modules/_asynciomodule.c:551:30
    #40 0x5ca5f2af94da in _asyncio_Task___init___impl /home/shamil/oss/cpython/main/./Modules/_asynciomodule.c:2332:9
    #41 0x5ca5f2af94da in _asyncio_Task___init__ /home/shamil/oss/cpython/main/./Modules/clinic/_asynciomodule.c.h:955:20
    #42 0x5ca5f26a98f8 in type_call /home/shamil/oss/cpython/main/Objects/typeobject.c:2460:19
    #43 0x5ca5f24d1b87 in _PyObject_Call /home/shamil/oss/cpython/main/Objects/call.c:361:18
    #44 0x5ca5f289d385 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32
    #45 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #46 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #47 0x5ca5f24db622 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #48 0x5ca5f24d8e96 in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18
    #49 0x5ca5f289d385 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32
    #50 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #51 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #52 0x5ca5f24db622 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #53 0x5ca5f24d8e96 in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18
    #54 0x5ca5f289d385 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32
    #55 0x5ca5f2539066 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #56 0x5ca5f2539066 in gen_send_ex2 /home/shamil/oss/cpython/main/Objects/genobject.c:259:24
    #57 0x5ca5f247c7f2 in PyIter_Send /home/shamil/oss/cpython/main/Objects/abstract.c:2928:28
    #58 0x5ca5f2ae3e06 in task_step_impl /home/shamil/oss/cpython/main/./Modules/_asynciomodule.c:3123:22
    #59 0x5ca5f2ae3568 in task_step /home/shamil/oss/cpython/main/./Modules/_asynciomodule.c:3463:11
    #60 0x5ca5f2ae2cba in TaskStepMethWrapper_call /home/shamil/oss/cpython/main/./Modules/_asynciomodule.c:2120:11
    #61 0x5ca5f24cfd56 in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18
    #62 0x5ca5f292307b in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:167:16
    #63 0x5ca5f292307b in context_run /home/shamil/oss/cpython/main/Python/context.c:728:29
    #64 0x5ca5f289d385 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32
    #65 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #66 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #67 0x5ca5f24db622 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #68 0x5ca5f24d8f46 in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:73:20
    #69 0x5ca5f2922f98 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #70 0x5ca5f2922f98 in context_run /home/shamil/oss/cpython/main/Python/context.c:728:29
    #71 0x5ca5f28acb49 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:3710:35
    #72 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #73 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #74 0x5ca5f24db622 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #75 0x5ca5f24d8f46 in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:73:20
    #76 0x5ca5f2c3f82d in thread_run /home/shamil/oss/cpython/main/./Modules/_threadmodule.c:387:21
    #77 0x5ca5f2aa8bec in pythread_wrapper /home/shamil/oss/cpython/main/Python/thread_pthread.h:234:5
    #78 0x5ca5f22d350a in asan_thread_start(void*) asan_interceptors.cpp.o
    #79 0x735a10ea3d63 in start_thread nptl/pthread_create.c:448:8
    #80 0x735a10f373bb in __GI___clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

==1410600==Register values:
rax = 0x0000000000000000  rbx = 0x000000000000000b  rcx = 0x0000735a10ea5fed  rdx = 0x000000000000000b  
rdi = 0x0000000000158628  rsi = 0x0000000000158b27  rbp = 0x00006f5a1003c5b0  rsp = 0x00006f5a1003c580  
 r8 = 0x0000000000000016   r9 = 0x00006f59c2fb06c0  r10 = 0x0000000000000000  r11 = 0x0000000000000246  
r12 = 0x0000000000158b27  r13 = 0x0000000000000002  r14 = 0x00006f59cabc6000  r15 = 0x000000000000000b  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV nptl/pthread_kill.c:44:76 in __pthread_kill_implementation
Thread T894 created by T0 here:
    #0 0x5ca5f22b9d05 in pthread_create (/home/shamil/oss/cpython/main/python+0x320d05) (BuildId: 886f38cd1398652417865b8c60cf746257ab32cc)
    #1 0x5ca5f2aa7177 in do_start_joinable_thread /home/shamil/oss/cpython/main/Python/thread_pthread.h:281:14
    #2 0x5ca5f2aa6e51 in PyThread_start_joinable_thread /home/shamil/oss/cpython/main/Python/thread_pthread.h:323:9
    #3 0x5ca5f2c3ed4c in ThreadHandle_start /home/shamil/oss/cpython/main/./Modules/_threadmodule.c:474:9
    #4 0x5ca5f2c3ed4c in do_start_new_thread /home/shamil/oss/cpython/main/./Modules/_threadmodule.c:1920:9
    #5 0x5ca5f2c3c4f2 in thread_PyThread_start_joinable_thread /home/shamil/oss/cpython/main/./Modules/_threadmodule.c:2043:14
    #6 0x5ca5f260b434 in cfunction_call /home/shamil/oss/cpython/main/Objects/methodobject.c:564:18
    #7 0x5ca5f24cfd56 in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18
    #8 0x5ca5f289ee39 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:3188:35
    #9 0x5ca5f2539066 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #10 0x5ca5f2539066 in gen_send_ex2 /home/shamil/oss/cpython/main/Objects/genobject.c:259:24
    #11 0x5ca5f2533d2b in gen_iternext /home/shamil/oss/cpython/main/Objects/genobject.c:634:9
    #12 0x5ca5f286fd5a in builtin_next /home/shamil/oss/cpython/main/Python/bltinmodule.c:1681:11
    #13 0x5ca5f28a4822 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2249:35
    #14 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #15 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #16 0x5ca5f24db622 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #17 0x5ca5f24d8e96 in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18
    #18 0x5ca5f289d385 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32
    #19 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #20 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #21 0x5ca5f24cf76b in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15
    #22 0x5ca5f24d2652 in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24
    #23 0x5ca5f26c6c42 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19
    #24 0x5ca5f24cfd56 in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18
    #25 0x5ca5f289eb31 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35
    #26 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #27 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #28 0x5ca5f24db622 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #29 0x5ca5f24d8e96 in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18
    #30 0x5ca5f289d385 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32
    #31 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #32 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #33 0x5ca5f24cf76b in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15
    #34 0x5ca5f24d2652 in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24
    #35 0x5ca5f26c6c42 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19
    #36 0x5ca5f24cfd56 in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18
    #37 0x5ca5f289eb31 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35
    #38 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #39 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #40 0x5ca5f24db622 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #41 0x5ca5f24d8e96 in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18
    #42 0x5ca5f289d385 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32
    #43 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #44 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #45 0x5ca5f24cf76b in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15
    #46 0x5ca5f24d2652 in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24
    #47 0x5ca5f26c6c42 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19
    #48 0x5ca5f24cfd56 in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18
    #49 0x5ca5f289eb31 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35
    #50 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #51 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #52 0x5ca5f287ad6f in PyEval_EvalCode /home/shamil/oss/cpython/main/Python/ceval.c:884:21
    #53 0x5ca5f286d7bd in builtin_exec_impl /home/shamil/oss/cpython/main/Python/bltinmodule.c:1180:17
    #54 0x5ca5f286d7bd in builtin_exec /home/shamil/oss/cpython/main/Python/clinic/bltinmodule.c.h:571:20
    #55 0x5ca5f24cf2c2 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11
    #56 0x5ca5f28b0206 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:1620:35
    #57 0x5ca5f287b942 in _PyEval_EvalFrame /home/shamil/oss/cpython/main/./Include/internal/pycore_ceval.h:121:16
    #58 0x5ca5f287b942 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12
    #59 0x5ca5f2ad4734 in pymain_run_module /home/shamil/oss/cpython/main/Modules/main.c:353:14
    #60 0x5ca5f2ad2fb5 in pymain_run_python /home/shamil/oss/cpython/main/Modules/main.c:685:21
    #61 0x5ca5f2ad2fb5 in Py_RunMain /home/shamil/oss/cpython/main/Modules/main.c:772:5
    #62 0x5ca5f2ad431e in pymain_main /home/shamil/oss/cpython/main/Modules/main.c:802:12
    #63 0x5ca5f2ad4483 in Py_BytesMain /home/shamil/oss/cpython/main/Modules/main.c:826:12
    #64 0x735a10e2a574 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #65 0x735a10e2a627 in __libc_start_main csu/../csu/libc-start.c:360:3
    #66 0x5ca5f22320d4 in _start (/home/shamil/oss/cpython/main/python+0x2990d4) (BuildId: 886f38cd1398652417865b8c60cf746257ab32cc)

==1410600==ABORTING

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    testsTests in the Lib/test dir
    type-crashA hard crash of the interpreter, possibly with a core dump
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    and removed
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    on Oct 21, 2025
  2. colesbury commented on Oct 21, 2025

    @colesbury
    Contributor

    Did it crash before #140262 ?

  3. sergey-miryanov commented on Oct 21, 2025

    @sergey-miryanov
    Contributor

    We chatted with @ashm-dev and if we revert 0c01090 it didn't crash.

    I tested on Ubuntu 24.04 with clang 18.1.3 and it didn't crash for -R 9:9. @ashm-dev retesting with this version now.

  4. 7 remaining items

  5. efimov-mikhail commented on Oct 22, 2025

    @efimov-mikhail
    Member

    git clean -dfx

    This command is kinda dangerous, it deletes even segfault.sh as well.
    Maybe git reset --hard will suit better?

  6. pgdr commented on Oct 22, 2025

    @pgdr
    Contributor

    My script is in another directory.

    The first bisect log: I will rerun it several times because the tests are flaky.

    Details
    git bisect start
    # status: waiting for both good and bad commits
    # bad: [a4709e525f5bc3a1719b33f52377cccb2af70278] GH-139193: Fix dump_stack when PYTHON_LLTRACE=4 (GH-139384)
    git bisect bad a4709e525f5bc3a1719b33f52377cccb2af70278
    # status: waiting for good commit(s), bad commit known
    # good: [47c5a0f307cff3ed477528536e8de095c0752efa] gh-125588: Allow to regenerate the parser with Python < 3.12 (#127969)
    git bisect good 47c5a0f307cff3ed477528536e8de095c0752efa
    # good: [c8f233c53b4634b820f2aa0efd45f43d9999aa1e] gh-132805: annotationlib: Fix handling of non-constant values in FORWARDREF (#132812)
    git bisect good c8f233c53b4634b820f2aa0efd45f43d9999aa1e
    # good: [dda9d0011fc3d3f561ca00ac83bf7a55a6325aa9] gh-108362: Retarget incremental GC changes to 3.14 (#125453)
    git bisect good dda9d0011fc3d3f561ca00ac83bf7a55a6325aa9
    # bad: [1da989be74eaa94590ec28e750e5352de1ead227] gh-138479: Ensure that `__typing_subst__` returns a tuple (GH-138482)
    git bisect bad 1da989be74eaa94590ec28e750e5352de1ead227
    # bad: [5c0231c27ad2a8b85e65b4189321c128561b20b4] gh-137725: Convert faulthandler to Argument Clinic (#137726)
    git bisect bad 5c0231c27ad2a8b85e65b4189321c128561b20b4
    # good: [676748d4da3671205f537ecd61a492861e37b77b] gh-132983: Fix docstrings in ``ZstdDict`` (#137321)
    git bisect good 676748d4da3671205f537ecd61a492861e37b77b
    # bad: [d7dbde895884d58e3da7ed4107fd33171afad7cb] gh-92936: allow double quote in cookie values (#113663)
    git bisect bad d7dbde895884d58e3da7ed4107fd33171afad7cb
    # bad: [c17f378c0efb67afb245fe2ef9e7dd2272541ff9] Use PyInitConfig API in _freeze_module.c (#137423)
    git bisect bad c17f378c0efb67afb245fe2ef9e7dd2272541ff9
    # good: [001461a29235216eb9c8295c66c323fdd34a7d59] gh-137390: Add missing line continuation character in configure.ac (#137391)
    git bisect good 001461a29235216eb9c8295c66c323fdd34a7d59
    # good: [39bd7c3156b00dda85ea09dffdde3e3536f37a55] GH-136155: Use ``sphinxext-opengraph`` v0.12.0 (#137393)
    git bisect good 39bd7c3156b00dda85ea09dffdde3e3536f37a55
    # good: [54a5fdffc8e20f111e7a7d2df352e8be057177ff] gh-137056: Fix DTrace build support on NetBSD (GH-137057)
    git bisect good 54a5fdffc8e20f111e7a7d2df352e8be057177ff
    # good: [781eb1a688e0575a38c79575493f3ff83208a33e] gh-137450: macOS installer shell path management improvements (#137451)
    git bisect good 781eb1a688e0575a38c79575493f3ff83208a33e
    # good: [3a79a122624bafe27252299b7f47f66a6059f732] Use PyConfig_Get() in frozenmain.c (#137421)
    git bisect good 3a79a122624bafe27252299b7f47f66a6059f732
    # first bad commit: [c17f378c0efb67afb245fe2ef9e7dd2272541ff9] Use PyInitConfig API in _freeze_module.c (#137423)
    
  7. colesbury commented on Oct 22, 2025

    @colesbury
    Contributor

    I can repro the crash. We need to initialize gen->gi_iframe.f_executable in make_gen() because that field is visited by gen_traverse

  8. added a commit that references this issue on Oct 22, 2025
  9. colesbury commented on Oct 22, 2025

    @colesbury
    Contributor

    Can you try the patch from #140470 ?

  10. pgdr commented on Oct 22, 2025

    @pgdr
    Contributor

    I got, again:

    # first bad commit: [c17f378] Use PyInitConfig API in _freeze_module.c (#137423)

    @colesbury will try it asap

  11. pgdr commented on Oct 22, 2025

    @pgdr
    Contributor

    @colesbury I could not reproduce the segfault it with the patch from #140470

    I will let it run an hour more to confirm.

  12. colesbury commented on Oct 22, 2025

    @colesbury
    Contributor

    The bad commit is probably b2afe2a (#123924)

  13. pgdr commented on Oct 23, 2025

    @pgdr
    Contributor

    The bad commit is probably b2afe2a (#123924)

    That could very well be, but for me, the first bad commit is c17f378 (#137423)

    That is the commit where that specific configuration starts to fail, i.e.,

    CC=clang CXX=clang++ ./configure --with-address-sanitizer --with-pydebug --disable-gil
    make -j12
    ./python -X dev -m test -R 9:9 test_asyncio.test_free_threading
  14. added a commit that references this issue on Oct 23, 2025
  15. added a commit that references this issue on Oct 23, 2025
  16. added a commit that references this issue on Oct 23, 2025
  17. sergey-miryanov commented on Oct 23, 2025

    @sergey-miryanov
    Contributor

    @pgdr Thanks for assistance!

  18. added a commit that references this issue on Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions