Skip to content

test_free_threading.test_type.TestType.test_attr_cache_consistency crashes intermittently #128804

Open
@mpage

Description

@mpage

Crash report

What happened?

The test_free_threading.test_type.TestType.test_attr_cache_consistency crashes intermittently. I unfortunately haven't been able to find a smaller reproducer than running test_free_threading forever using the matchfile below. Even then, it takes several hours for the crash to happen.

Repro

./python -m test test_free_threading -F --matchfile <matchfile>

Python backtrace:

Fatal Python error: Segmentation fault

<Cannot show all threads while the GIL is disabled>
Stack (most recent call first):
  File "/data/users/mpage/cpython/Lib/test/test_free_threading/test_type.py", line 62 in reader_func
  File "/data/users/mpage/cpython/Lib/threading.py", line 996 in run
  File "/data/users/mpage/cpython/Lib/threading.py", line 1054 in _bootstrap_inner
  File "/data/users/mpage/cpython/Lib/threading.py", line 1016 in _bootstrap

Extension modules: _testcapi, _testinternalcapi (total: 2)

Native backtrace:

(gdb) bt
#0  0x00007f528268bacc in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007f528263e686 in raise () from /lib64/libc.so.6
#2  0x000000000074168f in faulthandler_fatal_error (signum=11) at ./Modules/faulthandler.c:370
#3  <signal handler called>
#4  _Py_atomic_load_uint32_relaxed (obj=<optimized out>) at ./Include/cpython/pyatomic_gcc.h:367
#5  _Py_TryIncrefFast (op=<unknown at remote 0x2003631fa10>) at ./Include/internal/pycore_object.h:559
#6  _Py_TryIncref (op=<unknown at remote 0x2003631fa10>) at ./Include/internal/pycore_object.h:770
#7  _PyType_LookupRefAndVersion (type=type@entry=0x20001184b10, name=name@entry='x', version=version@entry=0x0) at Objects/typeobject.c:5557
#8  0x0000000000584b99 in _PyType_LookupRef (type=type@entry=0x20001184b10, name=name@entry='x') at Objects/typeobject.c:5649
#9  0x000000000058abb9 in _Py_type_getattro_impl (type=0x20001184b10, name='x', suppress_missing_attribute=suppress_missing_attribute@entry=0x0) at Objects/typeobject.c:5827
#10 0x000000000058ad19 in _Py_type_getattro (type=<optimized out>, name=<optimized out>) at Objects/typeobject.c:5878
#11 0x000000000053bffb in PyObject_GetAttr (v=v@entry=<type at remote 0x20001184b10>, name='x') at Objects/object.c:1286
#12 0x0000000000671470 in _PyEval_EvalFrameDefault (tstate=tstate@entry=0xb57100, frame=0x7f52824ff1c8, frame@entry=0x7f52824ff020, throwflag=throwflag@entry=0) at ./Include/internal/pycore_stackref.h:184
#13 0x0000000000682b0c in _PyEval_EvalFrame (throwflag=0, frame=0x7f52824ff020, tstate=0xb57100) at ./Include/internal/pycore_ceval.h:116
#14 _PyEval_Vector (tstate=<optimized out>, func=<optimized out>, locals=locals@entry=0x0, args=0x7f5268bffd08, argcount=1, kwnames=<optimized out>) at Python/ceval.c:1911
#15 0x00000000004b5497 in _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:413
#16 0x00000000004ba119 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=1, args=0x7f5268bffd08, callable=<function at remote 0x20000b8a810>, tstate=0xb57100) at ./Include/internal/pycore_call.h:167
#17 method_vectorcall (method=<optimized out>, args=<optimized out>, nargsf=<optimized out>, kwnames=0x0) at Objects/classobject.c:71
#18 0x00000000004b7c52 in _PyVectorcall_Call (tstate=tstate@entry=0xb57100, func=0x4b9e87 <method_vectorcall>, callable=callable@entry=<method at remote 0x2003e2d1b70>, tuple=tuple@entry=(), kwargs=kwargs@entry=0x0)
    at ./Include/object.h:783
#19 0x00000000004b7fbe in _PyObject_Call (tstate=0xb57100, callable=<method at remote 0x2003e2d1b70>, args=(), kwargs=0x0) at Objects/call.c:348
#20 0x00000000004b8015 in PyObject_Call (callable=<optimized out>, args=<optimized out>, kwargs=<optimized out>) at Objects/call.c:373
#21 0x00000000007bac89 in thread_run (boot_raw=boot_raw@entry=0xb4a8c0) at ./Modules/_threadmodule.c:346
#22 0x0000000000729cb9 in pythread_wrapper (arg=<optimized out>) at Python/thread_pthread.h:242
#23 0x00007f5282689d82 in start_thread () from /lib64/libc.so.6
#24 0x00007f528270ee20 in clone3 () from /lib64/libc.so.6
(gdb)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.14.0a3+ experimental free-threading build (heads/main:5e65a1acc0b, Jan 12 2025, 08:39:41) [GCC 11.5.0 20240719 (Red Hat 11.5.0-2)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtopic-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