Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-140306: Fix memory leaks in cross-interpreter data handling#140307

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@ashm-dev
Copy link
Contributor

@ashm-devashm-dev commentedOct 18, 2025
edited
Loading

Fixes three memory leaks detected by LeakSanitizer in cross-interpreter operations:

  1. _interpchannelsmodule.c: Fixed bitwise AND (&) incorrectly used instead of OR (|) when combiningXID_IGNORE_EXC andXID_FREE flags
  2. crossinterp.c (_release_xid_data): Fixed inverted ternary operator logic causing memory to be freed when it shouldn't and vice versa
  3. crossinterp.c (_PyXI_InitFailure): Added missingPyMem_RawFree() call in error path

Reduced memory leaks from 1565 bytes to 0 bytes intest__interpchannels.

@ashm-dev
Copy link
ContributorAuthor

Before

Using random seed: 28257856300:00:00 load avg: 1.82 Run 1 test in parallel using 1 worker process0:00:03 load avg: 1.82 [1/1/1] test__interpchannels worker non-zero exit code (Exit code 1)[0 refs, 0 blocks]===================================================================1082905==ERROR: LeakSanitizer: detected memory leaksDirect leak of 1088 byte(s) in 17 object(s) allocated from:    #0 0x60b0de3a54dd in calloc (/home/shamil/oss/cpython/main/python+0x9b34dd) (BuildId: 37792df6365e32052bfc7119c6be4df8fae85e76)    #1 0x60b0de96628f in _PyMem_DebugRawAlloc /home/shamil/oss/cpython/main/Objects/obmalloc.c:2884:24    #2 0x60b0deda055c in _PyXIData_New /home/shamil/oss/cpython/main/Python/crossinterp.c:309:24    #3 0x6f4afa7ba621 in channel_send /home/shamil/oss/cpython/main/./Modules/_interpchannelsmodule.c:1797:25    #4 0x6f4afa7aef84 in channelsmod_send /home/shamil/oss/cpython/main/./Modules/_interpchannelsmodule.c:3162:15    #5 0x60b0de8fec4a in cfunction_call /home/shamil/oss/cpython/main/Objects/methodobject.c:564:18    #6 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #7 0x60b0dec8c537 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2920:35    #8 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #9 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #10 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #11 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #12 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #13 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #14 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #15 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #16 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #17 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #18 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35    #19 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #20 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #21 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #22 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #23 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #24 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #25 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #26 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #27 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #28 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #29 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35Direct leak of 192 byte(s) in 3 object(s) allocated from:    #0 0x60b0de3a54dd in calloc (/home/shamil/oss/cpython/main/python+0x9b34dd) (BuildId: 37792df6365e32052bfc7119c6be4df8fae85e76)    #1 0x60b0de96628f in _PyMem_DebugRawAlloc /home/shamil/oss/cpython/main/Objects/obmalloc.c:2884:24    #2 0x60b0deda055c in _PyXIData_New /home/shamil/oss/cpython/main/Python/crossinterp.c:309:24    #3 0x6f4afa7ba621 in channel_send /home/shamil/oss/cpython/main/./Modules/_interpchannelsmodule.c:1797:25    #4 0x6f4afa7aef84 in channelsmod_send /home/shamil/oss/cpython/main/./Modules/_interpchannelsmodule.c:3162:15    #5 0x60b0de8fec4a in cfunction_call /home/shamil/oss/cpython/main/Objects/methodobject.c:564:18    #6 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #7 0x60b0dec8c537 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2920:35    #8 0x60b0dec3c23c in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #9 0x60b0dec3c23c in PyEval_EvalCode /home/shamil/oss/cpython/main/Python/ceval.c:884:21    #10 0x6f4afa740195 in _run_script /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c:632:24    #11 0x6f4afa740195 in _run_in_interpreter /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c:690:15    #12 0x6f4afa73d39d in _interpreters_run_string_impl /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c:1202:15    #13 0x6f4afa73d39d in _interpreters_run_string /home/shamil/oss/cpython/main/./Modules/clinic/_interpretersmodule.c.h:531:20    #14 0x60b0de773d6e in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #15 0x60b0dec904bc in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:1620:35    #16 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #17 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #18 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #19 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #20 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #21 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #22 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #23 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #24 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #25 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #26 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35    #27 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #28 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #29 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #30 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #31 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #32 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12Direct leak of 128 byte(s) in 2 object(s) allocated from:    #0 0x60b0de3a54dd in calloc (/home/shamil/oss/cpython/main/python+0x9b34dd) (BuildId: 37792df6365e32052bfc7119c6be4df8fae85e76)    #1 0x60b0de96628f in _PyMem_DebugRawAlloc /home/shamil/oss/cpython/main/Objects/obmalloc.c:2884:24    #2 0x60b0deda055c in _PyXIData_New /home/shamil/oss/cpython/main/Python/crossinterp.c:309:24    #3 0x6f4afa7ba621 in channel_send /home/shamil/oss/cpython/main/./Modules/_interpchannelsmodule.c:1797:25    #4 0x6f4afa7b8cd2 in channel_send_wait /home/shamil/oss/cpython/main/./Modules/_interpchannelsmodule.c:1858:15    #5 0x6f4afa7aef10 in channelsmod_send /home/shamil/oss/cpython/main/./Modules/_interpchannelsmodule.c:3158:15    #6 0x60b0de8fec4a in cfunction_call /home/shamil/oss/cpython/main/Objects/methodobject.c:564:18    #7 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #8 0x60b0dec8c537 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2920:35    #9 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #10 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #11 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #12 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #13 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #14 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #15 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #16 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #17 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #18 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #19 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35    #20 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #21 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #22 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #23 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #24 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #25 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #26 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #27 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #28 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #29 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18Direct leak of 64 byte(s) in 1 object(s) allocated from:    #0 0x60b0de3a54dd in calloc (/home/shamil/oss/cpython/main/python+0x9b34dd) (BuildId: 37792df6365e32052bfc7119c6be4df8fae85e76)    #1 0x60b0de96628f in _PyMem_DebugRawAlloc /home/shamil/oss/cpython/main/Objects/obmalloc.c:2884:24    #2 0x60b0deda8d71 in _PyXIData_New /home/shamil/oss/cpython/main/Python/crossinterp.c:309:24    #3 0x60b0deda8d71 in _sharednsitem_set_value /home/shamil/oss/cpython/main/Python/crossinterp.c:2071:20    #4 0x60b0deda8d71 in _sharednsitem_copy_from_ns /home/shamil/oss/cpython/main/Python/crossinterp.c:2121:9    #5 0x60b0deda8d71 in _fill_sharedns /home/shamil/oss/cpython/main/Python/crossinterp.c:2385:13    #6 0x60b0deda6d7f in _PyXI_Enter /home/shamil/oss/cpython/main/Python/crossinterp.c:2639:17    #7 0x6f4afa73e4ac in _interpreters_set___main___attrs_impl /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c:1072:9    #8 0x6f4afa73e4ac in _interpreters_set___main___attrs /home/shamil/oss/cpython/main/./Modules/clinic/_interpretersmodule.c.h:339:20    #9 0x60b0de773d6e in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #10 0x60b0dec904bc in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:1620:35    #11 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #12 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #13 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #14 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #15 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #16 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #17 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #18 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #19 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #20 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #21 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35    #22 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #23 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #24 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #25 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #26 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #27 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #28 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #29 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #30 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #31 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #32 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35    #33 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12Direct leak of 62 byte(s) in 2 object(s) allocated from:    #0 0x60b0de3a5308 in malloc (/home/shamil/oss/cpython/main/python+0x9b3308) (BuildId: 37792df6365e32052bfc7119c6be4df8fae85e76)    #1 0x60b0de966323 in _PyMem_DebugRawAlloc /home/shamil/oss/cpython/main/Objects/obmalloc.c:2887:24    #2 0x60b0deda6991 in _copy_string_obj_raw /home/shamil/oss/cpython/main/Python/crossinterp.c:1055:20    #3 0x60b0ded9be6f in _PyXI_InitFailure /home/shamil/oss/cpython/main/Python/crossinterp.c:1814:23    #4 0x6f4afa740461 in _run_script /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c    #5 0x6f4afa740461 in _run_in_interpreter /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c:690:15    #6 0x6f4afa73d39d in _interpreters_run_string_impl /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c:1202:15    #7 0x6f4afa73d39d in _interpreters_run_string /home/shamil/oss/cpython/main/./Modules/clinic/_interpretersmodule.c.h:531:20    #8 0x60b0de773d6e in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #9 0x60b0dec904bc in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:1620:35    #10 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #11 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #12 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #13 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #14 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #15 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #16 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #17 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #18 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #19 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #20 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35    #21 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #22 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #23 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #24 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #25 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #26 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #27 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #28 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #29 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #30 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #31 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35Direct leak of 31 byte(s) in 1 object(s) allocated from:    #0 0x60b0de3a5308 in malloc (/home/shamil/oss/cpython/main/python+0x9b3308) (BuildId: 37792df6365e32052bfc7119c6be4df8fae85e76)    #1 0x60b0de966323 in _PyMem_DebugRawAlloc /home/shamil/oss/cpython/main/Objects/obmalloc.c:2887:24    #2 0x60b0deda6991 in _copy_string_obj_raw /home/shamil/oss/cpython/main/Python/crossinterp.c:1055:20    #3 0x60b0ded9be6f in _PyXI_InitFailure /home/shamil/oss/cpython/main/Python/crossinterp.c:1814:23    #4 0x6f4afa740461 in _run_script /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c    #5 0x6f4afa740461 in _run_in_interpreter /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c:690:15    #6 0x6f4afa73d39d in _interpreters_run_string_impl /home/shamil/oss/cpython/main/./Modules/_interpretersmodule.c:1202:15    #7 0x6f4afa73d39d in _interpreters_run_string /home/shamil/oss/cpython/main/./Modules/clinic/_interpretersmodule.c.h:531:20    #8 0x60b0dec6bbcf in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2361:35    #9 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #10 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #11 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #12 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #13 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #14 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #15 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #16 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #17 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #18 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #19 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35    #20 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #21 0x60b0de784063 in _PyObject_VectorcallTstate /home/shamil/oss/cpython/main/./Include/internal/pycore_call.h:169:11    #22 0x60b0de7803dd in method_vectorcall /home/shamil/oss/cpython/main/Objects/classobject.c:95:18    #23 0x60b0de77692b in _PyVectorcall_Call /home/shamil/oss/cpython/main/Objects/call.c:273:16    #24 0x60b0dec70b70 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:2616:32    #25 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12    #26 0x60b0de77415e in _PyObject_VectorcallDictTstate /home/shamil/oss/cpython/main/Objects/call.c:135:15    #27 0x60b0de777e2d in _PyObject_Call_Prepend /home/shamil/oss/cpython/main/Objects/call.c:504:24    #28 0x60b0de9f0fe7 in call_method /home/shamil/oss/cpython/main/Objects/typeobject.c:3076:19    #29 0x60b0de7746be in _PyObject_MakeTpCall /home/shamil/oss/cpython/main/Objects/call.c:242:18    #30 0x60b0dec51bd5 in _PyEval_EvalFrameDefault /home/shamil/oss/cpython/main/Python/generated_cases.c.h:4021:35    #31 0x60b0dec3c6b1 in _PyEval_Vector /home/shamil/oss/cpython/main/Python/ceval.c:2001:12SUMMARY: AddressSanitizer: 1565 byte(s) leaked in 26 allocation(s).== Tests result: FAILURE ==1 test failed:    test__interpchannelsTotal duration: 3.2 secTotal tests: run=0Total test files: run=1/1 failed=1Result: FAILURE[0 refs, 0 blocks]

After

Using random seed: 16348766830:00:00 load avg: 6.85 Run 1 test in parallel using 1 worker process0:00:03 load avg: 6.54 [1/1] test__interpchannels passed[0 refs, 0 blocks]== Tests result: SUCCESS ==1 test OK.Total duration: 3.6 secTotal tests: run=70 skipped=5Total test files: run=1/1Result: SUCCESS[0 refs, 0 blocks]

@efimov-mikhail
Copy link
Member

I've also found similar bug inModules/_interpqueuesmodule.c. ExpressionXID_IGNORE_EXC & XID_FREE is used there.

@ashm-dev
Copy link
ContributorAuthor

I've also found similar bug in Modules/_interpqueuesmodule.c. Expression XID_IGNORE_EXC & XID_FREE is used there.

Each variant needs to be carefully checked there, because some are correct and some aren't. I didn't look at the others because there were no leaks there :)

@efimov-mikhail
Copy link
Member

efimov-mikhail commentedOct 18, 2025
edited
Loading

I think there're leaks there, you can find them withtest.test_interpreters.

But we can fix them in a separate PR.
Those 3 fixes which is already here LGTM.

ashm-dev reacted with thumbs up emoji

@serhiy-storchaka
Copy link
Member

XID_IGNORE_EXC & XID_FREE is never correct. It is simply 0.

efimov-mikhail and ashm-dev reacted with thumbs up emoji

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

And please fix all other occurrences ofXID_IGNORE_EXC & XID_FREE if there are any.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@ashm-dev
Copy link
ContributorAuthor

And please fix all other occurrences ofXID_IGNORE_EXC & XID_FREE if there are any.

There are no more such places in the code.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. 👍

ashm-dev reacted with thumbs up emoji
@serhiy-storchakaserhiy-storchaka merged commitf932321 intopython:mainOct 19, 2025
49 checks passed
@ashm-devashm-dev deleted the test__interpchannels_leak branchOctober 19, 2025 19:24
@serhiy-storchakaserhiy-storchaka added the needs backport to 3.14bugs and security fixes labelOct 19, 2025
@miss-islington-app
Copy link

Thanks@ashm-dev for the PR, and@serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 19, 2025
…ythonGH-140307)(cherry picked from commitf932321)Co-authored-by: Shamil <ashm.tech@proton.me>
@bedevere-app
Copy link

GH-140338 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelOct 19, 2025
@serhiy-storchakaserhiy-storchaka added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsOct 19, 2025
@miss-islington-app
Copy link

Thanks@ashm-dev for the PR, and@serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks@ashm-dev for the PR, and@serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry,@ashm-dev and@serhiy-storchaka, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker f9323213c98c9f1f7f3bf5af883b73047432fe50 3.13

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 19, 2025
…ythonGH-140307)(cherry picked from commitf932321)Co-authored-by: Shamil <ashm.tech@proton.me>
@miss-islington-app
Copy link

Sorry@ashm-dev and@serhiy-storchaka, I had trouble completing the backport.
Please retry by removing and re-adding the "needs backport to 3.14" label.
Please backport backport usingcherry_picker on the command line.

cherry_picker f9323213c98c9f1f7f3bf5af883b73047432fe50 3.14

serhiy-storchaka pushed a commit that referenced this pull requestOct 19, 2025
…GH-140307) (GH-140338)(cherry picked from commitf932321)Co-authored-by: Shamil <ashm.tech@proton.me>
@serhiy-storchakaserhiy-storchaka removed needs backport to 3.14bugs and security fixes needs backport to 3.13bugs and security fixes labelsOct 20, 2025
serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull requestOct 20, 2025
…ndling (pythonGH-140307)(cherry picked from commitf932321)Co-authored-by: Shamil <ashm.tech@proton.me>
@bedevere-app
Copy link

GH-140357 is a backport of this pull request to the3.13 branch.

serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull requestOct 20, 2025
…ndling (pythonGH-140307)(cherry picked from commitf932321)Co-authored-by: Shamil <ashm.tech@proton.me>
serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull requestOct 20, 2025
…ndling (pythonGH-140307)(cherry picked from commitf932321)Co-authored-by: Shamil <ashm.tech@proton.me>
serhiy-storchaka added a commit that referenced this pull requestOct 20, 2025
…GH-140307) (GH-140357)(cherry picked from commitf932321)Co-authored-by: Shamil <ashm.tech@proton.me>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

@efimov-mikhailefimov-mikhailefimov-mikhail approved these changes

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@ashm-dev@efimov-mikhail@serhiy-storchaka

[8]ページ先頭

©2009-2025 Movatter.jp