Skip to content

memory leak in threading stack size #141044

Description

@YuanchengJiang

Bug report

Bug description:

import threading
previous = threading.stack_size(127 * 1024)
def worker():
    pass
t = threading.Thread(target=worker, name="worker-thread")
t.start()
threading.stack_size(0)
LeakSanitizer output on main
=================================================================
==3532388==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7e646db509c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55cc45289c38 in _PyMem_RawMalloc ../Objects/obmalloc.c:63
    #2 0x55cc45289009 in _PyMem_DebugRawAlloc ../Objects/obmalloc.c:2887
    #3 0x55cc45289071 in _PyMem_DebugRawMalloc ../Objects/obmalloc.c:2920
    #4 0x55cc4528a8ef in _PyMem_DebugMalloc ../Objects/obmalloc.c:3085
    #5 0x55cc452b38dc in PyObject_Malloc ../Objects/obmalloc.c:1493
    #6 0x55cc454f3dd8 in _PyObject_MallocWithType ../Include/internal/pycore_object_alloc.h:46
    #7 0x55cc454f3dd8 in gc_alloc ../Python/gc.c:2344
    #8 0x55cc454f3f2e in _PyObject_GC_New ../Python/gc.c:2364
    #9 0x55cc451c9034 in PyMethod_New ../Objects/classobject.c:119
    #10 0x55cc452191a2 in cm_descr_get ../Objects/funcobject.c:1473
    #11 0x55cc452fdc1c in _Py_type_getattro_impl ../Objects/typeobject.c:6382
    #12 0x55cc452fde00 in _Py_type_getattro ../Objects/typeobject.c:6424
    #13 0x55cc45282b80 in PyObject_GetAttr ../Objects/object.c:1313
    #14 0x55cc45283dd3 in _PyObject_GetMethodStackRef ../Objects/object.c:1706
    #15 0x55cc45467d64 in _PyEval_EvalFrameDefault ../Python/generated_cases.c.h:7844
    #16 0x55cc45486105 in _PyEval_EvalFrame ../Include/internal/pycore_ceval.h:121
    #17 0x55cc454863f9 in _PyEval_Vector ../Python/ceval.c:2005
    #18 0x55cc451c12b7 in _PyFunction_Vectorcall ../Objects/call.c:413
    #19 0x55cc451c177e in _PyObject_VectorcallTstate ../Include/internal/pycore_call.h:169
    #20 0x55cc451c1c3c in _PyObject_CallFunctionVa ../Objects/call.c:552
    #21 0x55cc451c226d in callmethod ../Objects/call.c:626
    #22 0x55cc451c2472 in PyObject_CallMethod ../Objects/call.c:645
    #23 0x55cc45519b64 in init_importlib ../Python/import.c:3223
    #24 0x55cc4551ad12 in _PyImport_InitCore ../Python/import.c:4035
    #25 0x55cc45563be1 in pycore_interp_init ../Python/pylifecycle.c:942
    #26 0x55cc45563e06 in pyinit_config ../Python/pylifecycle.c:971
    #27 0x55cc455712e3 in pyinit_core ../Python/pylifecycle.c:1134
    #28 0x55cc4557153b in Py_InitializeFromConfig ../Python/pylifecycle.c:1454
    #29 0x55cc455d4c9e in pymain_init ../Modules/main.c:68
    #30 0x55cc455d50dc in pymain_main ../Modules/main.c:793

Indirect leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x7e646db509c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55cc45289c38 in _PyMem_RawMalloc ../Objects/obmalloc.c:63
    #2 0x55cc45289009 in _PyMem_DebugRawAlloc ../Objects/obmalloc.c:2887
    #3 0x55cc45289071 in _PyMem_DebugRawMalloc ../Objects/obmalloc.c:2920
    #4 0x55cc4528a8ef in _PyMem_DebugMalloc ../Objects/obmalloc.c:3085
    #5 0x55cc452b38dc in PyObject_Malloc ../Objects/obmalloc.c:1493
    #6 0x55cc454f3dd8 in _PyObject_MallocWithType ../Include/internal/pycore_object_alloc.h:46
    #7 0x55cc454f3dd8 in gc_alloc ../Python/gc.c:2344
    #8 0x55cc454f4037 in _PyObject_GC_NewVar ../Python/gc.c:2386
    #9 0x55cc452c9d82 in tuple_alloc ../Objects/tupleobject.c:57
    #10 0x55cc452cca50 in PyTuple_New ../Objects/tupleobject.c:81
    #11 0x55cc4554f81d in r_object ../Python/marshal.c:1372
    #12 0x55cc455504e9 in r_object ../Python/marshal.c:1560
    #13 0x55cc4554f9d8 in r_object ../Python/marshal.c:1378
    #14 0x55cc455504b9 in r_object ../Python/marshal.c:1554
    #15 0x55cc45551305 in read_object ../Python/marshal.c:1714
    #16 0x55cc45551558 in marshal_loads_impl ../Python/marshal.c:2059
    #17 0x55cc45551c95 in marshal_loads ../Python/clinic/marshal.c.h:344
    #18 0x55cc45446cfa in _PyEval_EvalFrameDefault ../Python/generated_cases.c.h:2361
    #19 0x55cc45486105 in _PyEval_EvalFrame ../Include/internal/pycore_ceval.h:121
    #20 0x55cc454863f9 in _PyEval_Vector ../Python/ceval.c:2005
    #21 0x55cc451c12b7 in _PyFunction_Vectorcall ../Objects/call.c:413
    #22 0x55cc451c177e in _PyObject_VectorcallTstate ../Include/internal/pycore_call.h:169
    #23 0x55cc451c34bf in object_vacall ../Objects/call.c:819
    #24 0x55cc451c373d in PyObject_CallMethodObjArgs ../Objects/call.c:886
    #25 0x55cc455133c5 in import_find_and_load ../Python/import.c:3688
    #26 0x55cc4551a2f5 in PyImport_ImportModuleLevelObject ../Python/import.c:3770
    #27 0x55cc454357c3 in _PyEval_ImportName ../Python/ceval.c:3025
    #28 0x55cc4545e461 in _PyEval_EvalFrameDefault ../Python/generated_cases.c.h:6219
    #29 0x55cc45486105 in _PyEval_EvalFrame ../Include/internal/pycore_ceval.h:121
    #30 0x55cc454863f9 in _PyEval_Vector ../Python/ceval.c:2005

Indirect leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x7e646db509c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55cc45289c38 in _PyMem_RawMalloc ../Objects/obmalloc.c:63
    #2 0x55cc45289009 in _PyMem_DebugRawAlloc ../Objects/obmalloc.c:2887
    #3 0x55cc45289071 in _PyMem_DebugRawMalloc ../Objects/obmalloc.c:2920
    #4 0x55cc4528a8ef in _PyMem_DebugMalloc ../Objects/obmalloc.c:3085
    #5 0x55cc452b38dc in PyObject_Malloc ../Objects/obmalloc.c:1493
    #6 0x55cc454f3dd8 in _PyObject_MallocWithType ../Include/internal/pycore_object_alloc.h:46
    #7 0x55cc454f3dd8 in gc_alloc ../Python/gc.c:2344
    #8 0x55cc454f3f2e in _PyObject_GC_New ../Python/gc.c:2364
    #9 0x55cc45276170 in PyCMethod_New ../Objects/methodobject.c:108
    #10 0x55cc451dea0b in method_get ../Objects/descrobject.c:158
    #11 0x55cc45284b2c in _PyObject_GenericGetAttrWithDict ../Objects/object.c:1893
    #12 0x55cc45285b28 in PyObject_GenericGetAttr ../Objects/object.c:1923
    #13 0x55cc45282b80 in PyObject_GetAttr ../Objects/object.c:1313
    #14 0x55cc45467f8a in _PyEval_EvalFrameDefault ../Python/generated_cases.c.h:7865
    #15 0x55cc45486105 in _PyEval_EvalFrame ../Include/internal/pycore_ceval.h:121
    #16 0x55cc454863f9 in _PyEval_Vector ../Python/ceval.c:2005
    #17 0x55cc451c12b7 in _PyFunction_Vectorcall ../Objects/call.c:413
    #18 0x55cc451c78c7 in _PyObject_VectorcallTstate ../Include/internal/pycore_call.h:169
    #19 0x55cc451c7d81 in method_vectorcall ../Objects/classobject.c:73
    #20 0x55cc451c4ad1 in _PyVectorcall_Call ../Objects/call.c:273
    #21 0x55cc451c50dd in _PyObject_Call ../Objects/call.c:348
    #22 0x55cc451c5123 in PyObject_Call ../Objects/call.c:373
    #23 0x55cc456d25b9 in thread_run ../Modules/_threadmodule.c:387
    #24 0x55cc455ade23 in pythread_wrapper ../Python/thread_pthread.h:234
    #25 0x7e646dab1a41 in asan_thread_start ../../../../src/libsanitizer/asan/asan_interceptors.cpp:234
    #26 0x7e646d7f4aa3  (/lib/x86_64-linux-gnu/libc.so.6+0x9caa3) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)

Indirect leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7e646db509c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55cc45289c38 in _PyMem_RawMalloc ../Objects/obmalloc.c:63
    #2 0x55cc45289009 in _PyMem_DebugRawAlloc ../Objects/obmalloc.c:2887
    #3 0x55cc45289071 in _PyMem_DebugRawMalloc ../Objects/obmalloc.c:2920
    #4 0x55cc4528a8ef in _PyMem_DebugMalloc ../Objects/obmalloc.c:3085
    #5 0x55cc452b38dc in PyObject_Malloc ../Objects/obmalloc.c:1493
    #6 0x55cc454f3dd8 in _PyObject_MallocWithType ../Include/internal/pycore_object_alloc.h:46
    #7 0x55cc454f3dd8 in gc_alloc ../Python/gc.c:2344
    #8 0x55cc454f3f2e in _PyObject_GC_New ../Python/gc.c:2364
    #9 0x55cc45250446 in new_dict ../Objects/dictobject.c:875
    #10 0x55cc45251b2f in PyDict_New ../Objects/dictobject.c:973
    #11 0x55cc45251b7e in dict_new_presized ../Objects/dictobject.c:2204
    #12 0x55cc45259e23 in _PyDict_FromItems ../Objects/dictobject.c:2245
    #13 0x55cc45440114 in _PyEval_EvalFrameDefault ../Python/generated_cases.c.h:1272
    #14 0x55cc45486105 in _PyEval_EvalFrame ../Include/internal/pycore_ceval.h:121
    #15 0x55cc454863f9 in _PyEval_Vector ../Python/ceval.c:2005
    #16 0x55cc451c12b7 in _PyFunction_Vectorcall ../Objects/call.c:413
    #17 0x55cc451c177e in _PyObject_VectorcallTstate ../Include/internal/pycore_call.h:169
    #18 0x55cc451c34bf in object_vacall ../Objects/call.c:819
    #19 0x55cc451c373d in PyObject_CallMethodObjArgs ../Objects/call.c:886
    #20 0x55cc455133c5 in import_find_and_load ../Python/import.c:3688
    #21 0x55cc4551a2f5 in PyImport_ImportModuleLevelObject ../Python/import.c:3770
    #22 0x55cc45426967 in builtin___import___impl ../Python/bltinmodule.c:285
    #23 0x55cc45426c32 in builtin___import__ ../Python/clinic/bltinmodule.c.h:110
    #24 0x55cc4527491b in cfunction_vectorcall_FASTCALL_KEYWORDS ../Objects/methodobject.c:465
    #25 0x55cc451c177e in _PyObject_VectorcallTstate ../Include/internal/pycore_call.h:169
    #26 0x55cc451c1c3c in _PyObject_CallFunctionVa ../Objects/call.c:552
    #27 0x55cc451c1e61 in PyObject_CallFunction ../Objects/call.c:574
    #28 0x55cc4551a8f4 in PyImport_Import ../Python/import.c:3962
    #29 0x55cc4551aa9f in PyImport_ImportModule ../Python/import.c:3410
    #30 0x55cc45564580 in init_import_site ../Python/pylifecycle.c:2741

Indirect leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7e646db509c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55cc45289c38 in _PyMem_RawMalloc ../Objects/obmalloc.c:63
    #2 0x55cc45289009 in _PyMem_DebugRawAlloc ../Objects/obmalloc.c:2887
    #3 0x55cc45289071 in _PyMem_DebugRawMalloc ../Objects/obmalloc.c:2920
    #4 0x55cc4528a8ef in _PyMem_DebugMalloc ../Objects/obmalloc.c:3085
    #5 0x55cc452b38dc in PyObject_Malloc ../Objects/obmalloc.c:1493
    #6 0x55cc454f3dd8 in _PyObject_MallocWithType ../Include/internal/pycore_object_alloc.h:46
    #7 0x55cc454f3dd8 in gc_alloc ../Python/gc.c:2344
    #8 0x55cc454f3f2e in _PyObject_GC_New ../Python/gc.c:2364
    #9 0x55cc45250446 in new_dict ../Objects/dictobject.c:875
    #10 0x55cc45251b2f in PyDict_New ../Objects/dictobject.c:973
    #11 0x55cc4542fff5 in initialize_locals ../Python/ceval.c:1583
    #12 0x55cc45432fd4 in _PyEvalFramePushAndInit ../Python/ceval.c:1875
    #13 0x55cc454863cf in _PyEval_Vector ../Python/ceval.c:1995
    #14 0x55cc451c12b7 in _PyFunction_Vectorcall ../Objects/call.c:413
    #15 0x55cc451c4453 in _PyObject_VectorcallDictTstate ../Objects/call.c:135
    #16 0x55cc451c4878 in _PyObject_Call_Prepend ../Objects/call.c:504
    #17 0x55cc452dae55 in slot_tp_new ../Objects/typeobject.c:10874
    #18 0x55cc452e93f8 in type_call ../Objects/typeobject.c:2449
    #19 0x55cc451c1570 in _PyObject_MakeTpCall ../Objects/call.c:242
    #20 0x55cc451c4589 in _PyObject_VectorcallDictTstate ../Objects/call.c:130
    #21 0x55cc451c46ac in PyObject_VectorcallDict ../Objects/call.c:159
    #22 0x55cc45427cda in builtin___build_class__ ../Python/bltinmodule.c:213
    #23 0x55cc4527491b in cfunction_vectorcall_FASTCALL_KEYWORDS ../Objects/methodobject.c:465
    #24 0x55cc451c177e in _PyObject_VectorcallTstate ../Include/internal/pycore_call.h:169
    #25 0x55cc451c1871 in PyObject_Vectorcall ../Objects/call.c:327
    #26 0x55cc45449f11 in _PyEval_EvalFrameDefault ../Python/generated_cases.c.h:2920
    #27 0x55cc45486105 in _PyEval_EvalFrame ../Include/internal/pycore_ceval.h:121
    #28 0x55cc454863f9 in _PyEval_Vector ../Python/ceval.c:2005
    #29 0x55cc454866a9 in PyEval_EvalCode ../Python/ceval.c:888
    #30 0x55cc45424bcb in builtin_exec_impl ../Python/bltinmodule.c:1180

Indirect leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7e646db509c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55cc45289c38 in _PyMem_RawMalloc ../Objects/obmalloc.c:63
    #2 0x55cc45289009 in _PyMem_DebugRawAlloc ../Objects/obmalloc.c:2887
    #3 0x55cc45289071 in _PyMem_DebugRawMalloc ../Objects/obmalloc.c:2920
    #4 0x55cc4528a8ef in _PyMem_DebugMalloc ../Objects/obmalloc.c:3085
    #5 0x55cc452b38dc in PyObject_Malloc ../Objects/obmalloc.c:1493
    #6 0x55cc454f3dd8 in _PyObject_MallocWithType ../Include/internal/pycore_object_alloc.h:46
    #7 0x55cc454f3dd8 in gc_alloc ../Python/gc.c:2344
    #8 0x55cc454f3f2e in _PyObject_GC_New ../Python/gc.c:2364
    #9 0x55cc451c9034 in PyMethod_New ../Objects/classobject.c:119
    #10 0x55cc452191a2 in cm_descr_get ../Objects/funcobject.c:1473
    #11 0x55cc452fdc1c in _Py_type_getattro_impl ../Objects/typeobject.c:6382
    #12 0x55cc452fde00 in _Py_type_getattro ../Objects/typeobject.c:6424
    #13 0x55cc45282b80 in PyObject_GetAttr ../Objects/object.c:1313
    #14 0x55cc45467f8a in _PyEval_EvalFrameDefault ../Python/generated_cases.c.h:7865
    #15 0x55cc45486105 in _PyEval_EvalFrame ../Include/internal/pycore_ceval.h:121
    #16 0x55cc454863f9 in _PyEval_Vector ../Python/ceval.c:2005
    #17 0x55cc451c12b7 in _PyFunction_Vectorcall ../Objects/call.c:413
    #18 0x55cc451c177e in _PyObject_VectorcallTstate ../Include/internal/pycore_call.h:169
    #19 0x55cc451c34bf in object_vacall ../Objects/call.c:819
    #20 0x55cc451c373d in PyObject_CallMethodObjArgs ../Objects/call.c:886
    #21 0x55cc455133c5 in import_find_and_load ../Python/import.c:3688
    #22 0x55cc4551a2f5 in PyImport_ImportModuleLevelObject ../Python/import.c:3770
    #23 0x55cc454357c3 in _PyEval_ImportName ../Python/ceval.c:3025
    #24 0x55cc4545e461 in _PyEval_EvalFrameDefault ../Python/generated_cases.c.h:6219
    #25 0x55cc45486105 in _PyEval_EvalFrame ../Include/internal/pycore_ceval.h:121
    #26 0x55cc454863f9 in _PyEval_Vector ../Python/ceval.c:2005
    #27 0x55cc451c12b7 in _PyFunction_Vectorcall ../Objects/call.c:413
    #28 0x55cc451c177e in _PyObject_VectorcallTstate ../Include/internal/pycore_call.h:169
    #29 0x55cc451c1ae5 in _PyObject_CallNoArgsTstate ../Include/internal/pycore_call.h:176
    #30 0x55cc451c1ae5 in _PyObject_CallFunctionVa ../Objects/call.c:531
    #31 0x55cc451c226d in callmethod ../Objects/call.c:626

SUMMARY: AddressSanitizer: 544 byte(s) leaked in 6 allocation(s).

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. efimov-mikhail commented on Nov 5, 2025

    @efimov-mikhail
    Member

    Thanks for the report!

    I can reproduce this issue with the following build command:
    ./configure --with-address-sanitizer --with-pydebug && make -j

    And I have to say that on main we have one list of leaks (6 allocation, as in the first post), on 3.13 there's no leaks and on 3.14 there's another list of leaks:

    LeakSanitizer output on 3.14
    
    =================================================================
    ==1434113==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 88 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcc6a in _PyObject_GC_New Python/gc.c:2308
        #9 0x55d6213ce64f in PyMethod_New Objects/classobject.c:119
        #10 0x55d62141c209 in cm_descr_get Objects/funcobject.c:1470
        #11 0x55d6214f6780 in _Py_type_getattro_impl Objects/typeobject.c:6061
        #12 0x55d6214f6960 in _Py_type_getattro Objects/typeobject.c:6103
        #13 0x55d6214814c7 in PyObject_GetAttr Objects/object.c:1299
        #14 0x55d62148180d in _PyObject_GetMethod Objects/object.c:1590
        #15 0x55d6216520ba in _PyEval_EvalFrameDefault Python/generated_cases.c.h:8019
        #16 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #17 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #18 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #19 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #20 0x55d6213c78f3 in _PyObject_CallFunctionVa Objects/call.c:552
        #21 0x55d6213c7e92 in callmethod Objects/call.c:626
        #22 0x55d6213c807e in PyObject_CallMethod Objects/call.c:645
        #23 0x55d62170162e in init_importlib Python/import.c:3236
        #24 0x55d6217026f3 in _PyImport_InitCore Python/import.c:4073
        #25 0x55d621747f17 in pycore_interp_init Python/pylifecycle.c:925
        #26 0x55d621748115 in pyinit_config Python/pylifecycle.c:954
        #27 0x55d6217528db in pyinit_core Python/pylifecycle.c:1117
        #28 0x55d621752b04 in Py_InitializeFromConfig Python/pylifecycle.c:1437
        #29 0x55d6217baafd in pymain_init Modules/main.c:68
        #30 0x55d6217baee1 in pymain_main Modules/main.c:796
    
    Indirect leak of 96 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcd6f in _PyObject_GC_NewVar Python/gc.c:2330
        #9 0x55d6214c4f25 in tuple_alloc Objects/tupleobject.c:57
        #10 0x55d6214c81ad in _PyTuple_FromArray Objects/tupleobject.c:393
        #11 0x55d6213e5f50 in method_vectorcall_VARARGS Objects/descrobject.c:316
        #12 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #13 0x55d6213c7584 in PyObject_Vectorcall Objects/call.c:327
        #14 0x55d621639c5e in _PyEval_EvalFrameDefault Python/generated_cases.c.h:4079
        #15 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #16 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #17 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #18 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #19 0x55d6213c8eff in object_vacall Objects/call.c:819
        #20 0x55d6213c9123 in PyObject_CallMethodObjArgs Objects/call.c:880
        #21 0x55d6216fb0db in import_find_and_load Python/import.c:3726
        #22 0x55d621701d79 in PyImport_ImportModuleLevelObject Python/import.c:3808
        #23 0x55d62161dfdd in _PyEval_ImportName Python/ceval.c:2981
        #24 0x55d62164808b in _PyEval_EvalFrameDefault Python/generated_cases.c.h:6345
        #25 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #26 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #27 0x55d621671d3d in PyEval_EvalCode Python/ceval.c:857
        #28 0x55d62160e430 in builtin_exec_impl Python/bltinmodule.c:1180
        #29 0x55d62160e701 in builtin_exec Python/clinic/bltinmodule.c.h:571
        #30 0x55d621473bc2 in cfunction_vectorcall_FASTCALL_KEYWORDS Objects/methodobject.c:465
    
    Indirect leak of 96 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcc6a in _PyObject_GC_New Python/gc.c:2308
        #9 0x55d6214753e9 in PyCMethod_New Objects/methodobject.c:108
        #10 0x55d6213e361b in method_get Objects/descrobject.c:158
        #11 0x55d621482a13 in _PyObject_GenericGetAttrWithDict Objects/object.c:1765
        #12 0x55d6214838ea in PyObject_GenericGetAttr Objects/object.c:1795
        #13 0x55d6214814c7 in PyObject_GetAttr Objects/object.c:1299
        #14 0x55d6216522e3 in _PyEval_EvalFrameDefault Python/generated_cases.c.h:8040
        #15 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #16 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #17 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #18 0x55d6213ccf7c in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #19 0x55d6213cd3f5 in method_vectorcall Objects/classobject.c:73
        #20 0x55d6213ca2bf in _PyVectorcall_Call Objects/call.c:273
        #21 0x55d6213ca89c in _PyObject_Call Objects/call.c:348
        #22 0x55d6213ca8de in PyObject_Call Objects/call.c:373
        #23 0x55d62189c496 in thread_run Modules/_threadmodule.c:359
        #24 0x55d62178dea0 in pythread_wrapper Python/thread_pthread.h:242
        #25 0x7fc5fd7c71f4 in start_thread nptl/pthread_create.c:442
    
    Indirect leak of 96 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcd6f in _PyObject_GC_NewVar Python/gc.c:2330
        #9 0x55d6214c4f25 in tuple_alloc Objects/tupleobject.c:57
        #10 0x55d6214c81ad in _PyTuple_FromArray Objects/tupleobject.c:393
        #11 0x55d6213e5f50 in method_vectorcall_VARARGS Objects/descrobject.c:316
        #12 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #13 0x55d6213c7584 in PyObject_Vectorcall Objects/call.c:327
        #14 0x55d62162a9fd in _PyEval_EvalFrameDefault Python/generated_cases.c.h:1619
        #15 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #16 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #17 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #18 0x55d6213ccf7c in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #19 0x55d6213cd3f5 in method_vectorcall Objects/classobject.c:73
        #20 0x55d6213ca2bf in _PyVectorcall_Call Objects/call.c:273
        #21 0x55d6213ca89c in _PyObject_Call Objects/call.c:348
        #22 0x55d6213ca8de in PyObject_Call Objects/call.c:373
        #23 0x55d62189c496 in thread_run Modules/_threadmodule.c:359
        #24 0x55d62178dea0 in pythread_wrapper Python/thread_pthread.h:242
        #25 0x7fc5fd7c71f4 in start_thread nptl/pthread_create.c:442
    
    Indirect leak of 96 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcd6f in _PyObject_GC_NewVar Python/gc.c:2330
        #9 0x55d6214c4f25 in tuple_alloc Objects/tupleobject.c:57
        #10 0x55d6214c7aff in PyTuple_New Objects/tupleobject.c:81
        #11 0x55d621737d13 in r_object Python/marshal.c:1372
        #12 0x55d6217389df in r_object Python/marshal.c:1560
        #13 0x55d621737ece in r_object Python/marshal.c:1378
        #14 0x55d6217389af in r_object Python/marshal.c:1554
        #15 0x55d6217397de in read_object Python/marshal.c:1714
        #16 0x55d621739a13 in marshal_loads_impl Python/marshal.c:2057
        #17 0x55d62173a0d9 in marshal_loads Python/clinic/marshal.c.h:344
        #18 0x55d62162f7b6 in _PyEval_EvalFrameDefault Python/generated_cases.c.h:2383
        #19 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #20 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #21 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #22 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #23 0x55d6213c8eff in object_vacall Objects/call.c:819
        #24 0x55d6213c9123 in PyObject_CallMethodObjArgs Objects/call.c:880
        #25 0x55d6216fb0db in import_find_and_load Python/import.c:3726
        #26 0x55d621701d79 in PyImport_ImportModuleLevelObject Python/import.c:3808
        #27 0x55d62161dfdd in _PyEval_ImportName Python/ceval.c:2981
        #28 0x55d62164808b in _PyEval_EvalFrameDefault Python/generated_cases.c.h:6345
        #29 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #30 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
    
    Indirect leak of 88 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcc6a in _PyObject_GC_New Python/gc.c:2308
        #9 0x55d6213ce64f in PyMethod_New Objects/classobject.c:119
        #10 0x55d62141c209 in cm_descr_get Objects/funcobject.c:1470
        #11 0x55d6214f6780 in _Py_type_getattro_impl Objects/typeobject.c:6061
        #12 0x55d6214f6960 in _Py_type_getattro Objects/typeobject.c:6103
        #13 0x55d6214814c7 in PyObject_GetAttr Objects/object.c:1299
        #14 0x55d6216522e3 in _PyEval_EvalFrameDefault Python/generated_cases.c.h:8040
        #15 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #16 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #17 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #18 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #19 0x55d6213c8eff in object_vacall Objects/call.c:819
        #20 0x55d6213c9123 in PyObject_CallMethodObjArgs Objects/call.c:880
        #21 0x55d6216fb0db in import_find_and_load Python/import.c:3726
        #22 0x55d621701d79 in PyImport_ImportModuleLevelObject Python/import.c:3808
        #23 0x55d62161dfdd in _PyEval_ImportName Python/ceval.c:2981
        #24 0x55d62164808b in _PyEval_EvalFrameDefault Python/generated_cases.c.h:6345
        #25 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #26 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #27 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #28 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #29 0x55d6213c77b8 in _PyObject_CallNoArgsTstate Include/internal/pycore_call.h:176
        #30 0x55d6213c77b8 in _PyObject_CallFunctionVa Objects/call.c:531
        #31 0x55d6213c7e92 in callmethod Objects/call.c:626
    
    Indirect leak of 88 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcc6a in _PyObject_GC_New Python/gc.c:2308
        #9 0x55d621450e81 in new_dict Objects/dictobject.c:877
        #10 0x55d6214525d6 in PyDict_New Objects/dictobject.c:976
        #11 0x55d621618abc in initialize_locals Python/ceval.c:1543
        #12 0x55d62161b981 in _PyEvalFramePushAndInit Python/ceval.c:1835
        #13 0x55d621671a8a in _PyEval_Vector Python/ceval.c:1955
        #14 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #15 0x55d6213c9cc4 in _PyObject_VectorcallDictTstate Objects/call.c:135
        #16 0x55d6213ca09f in _PyObject_Call_Prepend Objects/call.c:504
        #17 0x55d6214d5a32 in slot_tp_new Objects/typeobject.c:10486
        #18 0x55d6214e39a8 in type_call Objects/typeobject.c:2309
        #19 0x55d6213c728b in _PyObject_MakeTpCall Objects/call.c:242
        #20 0x55d6213c9dd5 in _PyObject_VectorcallDictTstate Objects/call.c:130
        #21 0x55d6213c9ee6 in PyObject_VectorcallDict Objects/call.c:159
        #22 0x55d6216112d8 in builtin___build_class__ Python/bltinmodule.c:214
        #23 0x55d621473bc2 in cfunction_vectorcall_FASTCALL_KEYWORDS Objects/methodobject.c:465
        #24 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #25 0x55d6213c7584 in PyObject_Vectorcall Objects/call.c:327
        #26 0x55d621632c51 in _PyEval_EvalFrameDefault Python/generated_cases.c.h:2959
        #27 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #28 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #29 0x55d621671d3d in PyEval_EvalCode Python/ceval.c:857
        #30 0x55d62160e430 in builtin_exec_impl Python/bltinmodule.c:1180
    
    Indirect leak of 88 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcc6a in _PyObject_GC_New Python/gc.c:2308
        #9 0x55d621450e81 in new_dict Objects/dictobject.c:877
        #10 0x55d6214525d6 in PyDict_New Objects/dictobject.c:976
        #11 0x55d62145262d in dict_new_presized Objects/dictobject.c:2153
        #12 0x55d62145a087 in _PyDict_FromItems Objects/dictobject.c:2196
        #13 0x55d621628755 in _PyEval_EvalFrameDefault Python/generated_cases.c.h:1271
        #14 0x55d6216717db in _PyEval_EvalFrame Include/internal/pycore_ceval.h:121
        #15 0x55d621671ab4 in _PyEval_Vector Python/ceval.c:1965
        #16 0x55d6213c6fda in _PyFunction_Vectorcall Objects/call.c:413
        #17 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #18 0x55d6213c8eff in object_vacall Objects/call.c:819
        #19 0x55d6213c9123 in PyObject_CallMethodObjArgs Objects/call.c:880
        #20 0x55d6216fb0db in import_find_and_load Python/import.c:3726
        #21 0x55d621701d79 in PyImport_ImportModuleLevelObject Python/import.c:3808
        #22 0x55d621610049 in builtin___import___impl Python/bltinmodule.c:285
        #23 0x55d621610301 in builtin___import__ Python/clinic/bltinmodule.c.h:110
        #24 0x55d621473bc2 in cfunction_vectorcall_FASTCALL_KEYWORDS Objects/methodobject.c:465
        #25 0x55d6213c7499 in _PyObject_VectorcallTstate Include/internal/pycore_call.h:169
        #26 0x55d6213c78f3 in _PyObject_CallFunctionVa Objects/call.c:552
        #27 0x55d6213c7af7 in PyObject_CallFunction Objects/call.c:574
        #28 0x55d621702352 in PyImport_Import Python/import.c:4000
        #29 0x55d6217024bf in PyImport_ImportModule Python/import.c:3423
        #30 0x55d62174882d in init_import_site Python/pylifecycle.c:2615
    
    Indirect leak of 80 byte(s) in 1 object(s) allocated from:
        #0 0x7fc5fdab89cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
        #1 0x55d621487a7a in _PyMem_RawMalloc Objects/obmalloc.c:63
        #2 0x55d621486ef3 in _PyMem_DebugRawAlloc Objects/obmalloc.c:2872
        #3 0x55d621486f57 in _PyMem_DebugRawMalloc Objects/obmalloc.c:2905
        #4 0x55d6214886ab in _PyMem_DebugMalloc Objects/obmalloc.c:3070
        #5 0x55d6214af46b in PyObject_Malloc Objects/obmalloc.c:1478
        #6 0x55d6216dcb12 in _PyObject_MallocWithType Include/internal/pycore_object_alloc.h:46
        #7 0x55d6216dcb12 in gc_alloc Python/gc.c:2288
        #8 0x55d6216dcd6f in _PyObject_GC_NewVar Python/gc.c:2330
        #9 0x55d6214c4f25 in tuple_alloc Objects/tupleobject.c:57
        #10 0x55d6214c7aff in PyTuple_New Objects/tupleobject.c:81
        #11 0x55d621737d13 in r_object Python/marshal.c:1372
        #12 0x55d621737ece in r_object Python/marshal.c:1378
        #13 0x55d6217389af in r_object Python/marshal.c:1554
        #14 0x55d6217397de in read_object Python/marshal.c:1714
        #15 0x55d62173b7db in PyMarshal_ReadObjectFromString Python/marshal.c:1833
        #16 0x55d6218c11c7 in _Py_Get_Getpath_CodeObject Modules/getpath.c:835
        #17 0x55d6218c12d8 in _PyConfig_InitPathConfig Modules/getpath.c:890
        #18 0x55d62170affd in config_init_import Python/initconfig.c:2587
        #19 0x55d621713287 in _PyConfig_InitImportConfig Python/initconfig.c:2631
        #20 0x55d621750e1e in init_interp_main Python/pylifecycle.c:1199
        #21 0x55d621751922 in pyinit_main Python/pylifecycle.c:1413
        #22 0x55d621752be5 in Py_InitializeFromConfig Python/pylifecycle.c:1444
        #23 0x55d6217baafd in pymain_init Modules/main.c:68
        #24 0x55d6217baee1 in pymain_main Modules/main.c:796
        #25 0x55d6217bb204 in Py_BytesMain Modules/main.c:829
        #26 0x55d621262b61 in main Programs/python.c:15
        #27 0x7fc5fd765249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    
    SUMMARY: AddressSanitizer: 816 byte(s) leaked in 9 allocation(s).
    
    
  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 5, 2025
  3. brijkapadia commented on Feb 9, 2026

    @brijkapadia
    Contributor

    I’m interested in working on this issue and investigating the leak.

    Is anyone else already working on it, or made any progress?

  4. KingLizard1020 commented on Sep 14, 2026

    @KingLizard1020

    I'll investigate and work on a fix for the threading.stack_size ASan leak on main/3.14+ (repro from the issue). Will open a PR once I have a clean diagnosis.

  5. added 2 commits that reference this issue on Sep 14, 2026
  6. added a commit that references this issue on Sep 17, 2026
  7. added 10 commits that reference this issue on Sep 21, 2026
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

    3.14bugs and security fixes3.15bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions