You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ASAN : Memory leak found in python3.9.9 regrtest #94064
tar xf Python-3.9.9.tar.xz
cd Python-3.9.9
CFLAGS='-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link'
CXXFLAGS='-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++'# Ignore memory leaks from python scripts invoked in the buildexport ASAN_OPTIONS="detect_leaks=0"export MSAN_OPTIONS="halt_on_error=0:exitcode=0:report_umrs=0"# Remove -pthread from CFLAGS, this trips up ./configure# which thinks pthreads are available without any CLI flags
CFLAGS=${CFLAGS//"-pthread"/}
./configure --disable-ipv6 --without-ensurepip --with-address-sanitizer
# We use altinstall to avoid having the Makefile create symlinks
make -j$(nproc)
python -m test --list-tests > tests
fortin$(cat tests);do
./python -m test.regrtest "${t}" -wW
done
Bug report
following test cases were found to have memory leak problem by asan:
0:00:00 load avg: 2.44 Run tests sequentially
0:00:00 load avg: 2.44 [1/1] test_support
test_CleanImport (test.test_support.TestSupport) ... ok
test_DirsOnSysPath (test.test_support.TestSupport) ... ok
test_HOST (test.test_support.TestSupport) ... ok
test_args_from_interpreter_flags (test.test_support.TestSupport) ... test_bind_port (test.test_support.TestSupport) ... ok
test_captured_stderr (test.test_support.TestSupport) ... ok
test_captured_stdin (test.test_support.TestSupport) ... ok
test_captured_stdout (test.test_support.TestSupport) ... ok
test_change_cwd (test.test_support.TestSupport) ... ok
test_change_cwd__chdir_warning (test.test_support.TestSupport)
Check the warning message when os.chdir() fails. ... ok
test_change_cwd__non_existent_dir (test.test_support.TestSupport)
Test passing a non-existent directory. ... ok
test_change_cwd__non_existent_dir__quiet_true (test.test_support.TestSupport)
Test passing a non-existent directory with quiet=True. ... ok
test_check__all__ (test.test_support.TestSupport) ... ok
test_check_syntax_error (test.test_support.TestSupport) ... ok
test_detect_api_mismatch (test.test_support.TestSupport) ... ok
test_detect_api_mismatch__ignore (test.test_support.TestSupport) ... ok
test_fd_count (test.test_support.TestSupport) ... ok
test_find_unused_port (test.test_support.TestSupport) ... ok
test_forget (test.test_support.TestSupport) ... ok
test_gc_collect (test.test_support.TestSupport) ... ok
test_get_attribute (test.test_support.TestSupport) ... ok
test_get_original_stdout (test.test_support.TestSupport) ... skipped 'failing buildbots'
test_ignored_deprecations_are_silent (test.test_support.TestSupport)
Test support.ignore_deprecations_from() silences warnings ... ok
test_import_fresh_module (test.test_support.TestSupport) ... ok
test_import_module (test.test_support.TestSupport) ... ok
test_make_bad_fd (test.test_support.TestSupport) ... ok
test_match_test (test.test_support.TestSupport) ... ok
test_optim_args_from_interpreter_flags (test.test_support.TestSupport) ... ok
test_print_warning (test.test_support.TestSupport) ... ok
test_python_is_optimized (test.test_support.TestSupport) ... ok
test_reap_children (test.test_support.TestSupport) ... ok
test_rmtree (test.test_support.TestSupport) ... ok
test_sortdict (test.test_support.TestSupport) ... ok
test_swap_attr (test.test_support.TestSupport) ... ok
test_swap_item (test.test_support.TestSupport) ... ok
test_temp_cwd (test.test_support.TestSupport) ... ok
test_temp_cwd__name_none (test.test_support.TestSupport)
Test passing None to temp_cwd(). ... ok
test_temp_dir (test.test_support.TestSupport)
Test that temp_dir() creates and destroys its directory. ... ok
test_temp_dir__existing_dir__quiet_default (test.test_support.TestSupport)
Test passing a directory that already exists. ... ok
test_temp_dir__existing_dir__quiet_true (test.test_support.TestSupport)
Test passing a directory that already exists with quiet=True. ... ok
test_temp_dir__forked_child (test.test_support.TestSupport)
Test that a forked child process does not remove the directory. ... FAIL
test_temp_dir__path_none (test.test_support.TestSupport)
Test passing no path. ... ok
test_unlink (test.test_support.TestSupport) ... ok
test_unload (test.test_support.TestSupport) ... ok
======================================================================
FAIL: test_args_from_interpreter_flags (test.test_support.TestSupport) (opts=['-X', 'tracemalloc'])
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 531, in test_args_from_interpreter_flags
self.check_options(opts, 'args_from_interpreter_flags')
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 500, in check_options
self.assertEqual(proc.returncode, 0)
AssertionError: 1 != 0
======================================================================
FAIL: test_args_from_interpreter_flags (test.test_support.TestSupport) (opts=['-X', 'tracemalloc=3'])
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 531, in test_args_from_interpreter_flags
self.check_options(opts, 'args_from_interpreter_flags')
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 500, in check_options
self.assertEqual(proc.returncode, 0)
AssertionError: 1 != 0
======================================================================
FAIL: test_temp_dir__forked_child (test.test_support.TestSupport)
Test that a forked child process does not remove the directory.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 202, in test_temp_dir__forked_child
script_helper.assert_python_ok("-c", textwrap.dedent("""
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/support/script_helper.py", line 156, in assert_python_ok
return _assert_python(True, *args, **env_vars)
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/support/script_helper.py", line 142, in _assert_python
res.fail(cmd_line)
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/support/script_helper.py", line 70, in fail
raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/root/rpmbuild/BUILD/Python-3.9.9/python', '-X', 'faulthandler', '-I', '-c', '\nimport os\nfrom test import support\nwith support.temp_cwd() as temp_path:\n pid = os.fork()\n if pid != 0:\n # parent process\n\n # wait for the child to terminate\n support.wait_process(pid, exitcode=0)\n\n # Make sure that temp_path is still present. When the child\n # process leaves the \'temp_cwd\'-context, the __exit__()-\n # method of the context must not remove the temporary\n # directory.\n if not os.path.isdir(temp_path):\n raise AssertionError("Child removed temp_path.")\n']
stdout:
---
---
stderr:
---
(... truncated stderr ...)x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#23 0x4621e8 in _PyFunction_Vectorcall Objects/call.c:396
#24 0x4359d4 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#25 0x4359d4 in PyObject_Vectorcall Include/cpython/abstract.h:127
#26 0x4359d4 in call_function Python/ceval.c:5075
#27 0x4359d4 in _PyEval_EvalFrameDefault Python/ceval.c:3535
#28 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#29 0x42265c in function_code_fastcall Objects/call.c:330
#30 0x463884 in _PyObject_FastCallDictTstate Objects/call.c:118
#31 0x463884 in _PyObject_Call_Prepend Objects/call.c:489
#32 0x540d5d in slot_tp_init Objects/typeobject.c:6964
#33 0x51e8d7 in type_call Objects/typeobject.c:1026
#34 0x45eedc in _PyObject_MakeTpCall Objects/call.c:191
#35 0x437946 in _PyObject_VectorcallTstate Include/cpython/abstract.h:116
#36 0x437946 in _PyObject_VectorcallTstate Include/cpython/abstract.h:103
#37 0x437946 in PyObject_Vectorcall Include/cpython/abstract.h:127
#38 0x437946 in call_function Python/ceval.c:5075
#39 0x437946 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#40 0x5f6ce7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#41 0x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#42 0x5f74e6 in _PyEval_EvalCodeWithName Python/ceval.c:4359
#43 0x5f74e6 in PyEval_EvalCodeEx Python/ceval.c:4375
#44 0x5f74e6 in PyEval_EvalCode Python/ceval.c:826
#45 0x8f9e00 in builtin_exec_impl Python/bltinmodule.c:1026
#46 0x8f9e00 in builtin_exec Python/clinic/bltinmodule.c.h:396
#47 0x87f087 in cfunction_vectorcall_FASTCALL Objects/methodobject.c:430
#48 0x4610ac in PyVectorcall_Call Objects/call.c:231
#49 0x42c932 in do_call_core Python/ceval.c:5123
#50 0x42c932 in _PyEval_EvalFrameDefault Python/ceval.c:3580
#51 0x5f6ce7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#52 0x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#53 0x4621e8 in _PyFunction_Vectorcall Objects/call.c:396
#54 0x437c94 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#55 0x437c94 in PyObject_Vectorcall Include/cpython/abstract.h:127
#56 0x437c94 in call_function Python/ceval.c:5075
#57 0x437c94 in _PyEval_EvalFrameDefault Python/ceval.c:3487
#58 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#59 0x42265c in function_code_fastcall Objects/call.c:330
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7f462732a1b7 in __interceptor_malloc (/usr/lib64/libasan.so.6+0xaf1b7)
#1 0x6c416d in PyThread_allocate_lock Python/thread_pthread.h:389
#2 0x7b7535 in newlockobject Modules/_threadmodule.c:577
#3 0x7b7535 in thread__set_sentinel Modules/_threadmodule.c:1278
#4 0x87f3f5 in cfunction_vectorcall_NOARGS Objects/methodobject.c:489
#5 0x436237 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#6 0x436237 in PyObject_Vectorcall Include/cpython/abstract.h:127
#7 0x436237 in call_function Python/ceval.c:5075
#8 0x436237 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#9 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#10 0x42265c in function_code_fastcall Objects/call.c:330
#11 0x438eaf in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#12 0x438eaf in PyObject_Vectorcall Include/cpython/abstract.h:127
#13 0x438eaf in call_function Python/ceval.c:5075
#14 0x438eaf in _PyEval_EvalFrameDefault Python/ceval.c:3504
#15 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#16 0x42265c in function_code_fastcall Objects/call.c:330
#17 0x463884 in _PyObject_FastCallDictTstate Objects/call.c:118
#18 0x463884 in _PyObject_Call_Prepend Objects/call.c:489
#19 0x540d5d in slot_tp_init Objects/typeobject.c:6964
#20 0x51e8d7 in type_call Objects/typeobject.c:1026
#21 0x45eedc in _PyObject_MakeTpCall Objects/call.c:191
#22 0x437946 in _PyObject_VectorcallTstate Include/cpython/abstract.h:116
#23 0x437946 in _PyObject_VectorcallTstate Include/cpython/abstract.h:103
#24 0x437946 in PyObject_Vectorcall Include/cpython/abstract.h:127
#25 0x437946 in call_function Python/ceval.c:5075
#26 0x437946 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#27 0x5f6ce7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#28 0x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#29 0x5f74e6 in _PyEval_EvalCodeWithName Python/ceval.c:4359
#30 0x5f74e6 in PyEval_EvalCodeEx Python/ceval.c:4375
#31 0x5f74e6 in PyEval_EvalCode Python/ceval.c:826
#32 0x8f9e00 in builtin_exec_impl Python/bltinmodule.c:1026
#33 0x8f9e00 in builtin_exec Python/clinic/bltinmodule.c.h:396
#34 0x87f087 in cfunction_vectorcall_FASTCALL Objects/methodobject.c:430
#35 0x4610ac in PyVectorcall_Call Objects/call.c:231
#36 0x42c932 in do_call_core Python/ceval.c:5123
#37 0x42c932 in _PyEval_EvalFrameDefault Python/ceval.c:3580
#38 0x5f6ce7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#39 0x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#40 0x4621e8 in _PyFunction_Vectorcall Objects/call.c:396
#41 0x437c94 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#42 0x437c94 in PyObject_Vectorcall Include/cpython/abstract.h:127
#43 0x437c94 in call_function Python/ceval.c:5075
#44 0x437c94 in _PyEval_EvalFrameDefault Python/ceval.c:3487
#45 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#46 0x42265c in function_code_fastcall Objects/call.c:330
#47 0x438eaf in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#48 0x438eaf in PyObject_Vectorcall Include/cpython/abstract.h:127
#49 0x438eaf in call_function Python/ceval.c:5075
#50 0x438eaf in _PyEval_EvalFrameDefault Python/ceval.c:3504
#51 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#52 0x42265c in function_code_fastcall Objects/call.c:330
#53 0x436237 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#54 0x436237 in PyObject_Vectorcall Include/cpython/abstract.h:127
#55 0x436237 in call_function Python/ceval.c:5075
#56 0x436237 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#57 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#58 0x42265c in function_code_fastcall Objects/call.c:330
#59 0x436237 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#60 0x436237 in PyObject_Vectorcall Include/cpython/abstract.h:127
#61 0x436237 in call_function Python/ceval.c:5075
#62 0x436237 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#63 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#64 0x42265c in function_code_fastcall Objects/call.c:330
#65 0x45fe2e in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#66 0x45fe2e in object_vacall Objects/call.c:792
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7f462732a1b7 in __interceptor_malloc (/usr/lib64/libasan.so.6+0xaf1b7)
#1 0x6c416d in PyThread_allocate_lock Python/thread_pthread.h:389
#2 0x694390 in _PyRuntimeState_Init_impl Python/pystate.c:74
#3 0x694390 in _PyRuntimeState_Init Python/pystate.c:99
#4 0x68f363 in _PyRuntime_Initialize Python/pylifecycle.c:82
#5 0x68f363 in _PyRuntime_Initialize Python/pylifecycle.c:69
#6 0x43f8db in pymain_init Modules/main.c:38
#7 0x442e12 in pymain_main Modules/main.c:698
#8 0x442e12 in Py_BytesMain Modules/main.c:731
#9 0x7f4626fcb26f (/usr/lib64/libc.so.6+0x2d26f)
SUMMARY: AddressSanitizer: 192 byte(s) leaked in 6 allocation(s).
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/support/__init__.py", line 3164, in wait_process
raise AssertionError(f"process {pid} exited with code {exitcode2}, "
AssertionError: process 92117 exited with code 1, but exit code 0 is expected
---
----------------------------------------------------------------------
Ran 44 tests in 11.721s
FAILED (failures=3, skipped=1)
test test_support failed
test_support failed (3 failures)
== Tests result: FAILURE ==
1 test failed:
test_support
0:00:11 load avg: 2.22
0:00:11 load avg: 2.22 Re-running failed tests in verbose mode
0:00:11 load avg: 2.22 Re-running test_support in verbose mode (matching: test_args_from_interpreter_flags, test_args_from_interpreter_flags, test_temp_dir__forked_child)
test_args_from_interpreter_flags (test.test_support.TestSupport) ... test_temp_dir__forked_child (test.test_support.TestSupport)
Test that a forked child process does not remove the directory. ... FAIL
======================================================================
FAIL: test_args_from_interpreter_flags (test.test_support.TestSupport) (opts=['-X', 'tracemalloc'])
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 531, in test_args_from_interpreter_flags
self.check_options(opts, 'args_from_interpreter_flags')
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 500, in check_options
self.assertEqual(proc.returncode, 0)
AssertionError: 1 != 0
======================================================================
FAIL: test_args_from_interpreter_flags (test.test_support.TestSupport) (opts=['-X', 'tracemalloc=3'])
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 531, in test_args_from_interpreter_flags
self.check_options(opts, 'args_from_interpreter_flags')
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 500, in check_options
self.assertEqual(proc.returncode, 0)
AssertionError: 1 != 0
======================================================================
FAIL: test_temp_dir__forked_child (test.test_support.TestSupport)
Test that a forked child process does not remove the directory.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/test_support.py", line 202, in test_temp_dir__forked_child
script_helper.assert_python_ok("-c", textwrap.dedent("""
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/support/script_helper.py", line 156, in assert_python_ok
return _assert_python(True, *args, **env_vars)
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/support/script_helper.py", line 142, in _assert_python
res.fail(cmd_line)
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/support/script_helper.py", line 70, in fail
raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 1
command line: ['/root/rpmbuild/BUILD/Python-3.9.9/python', '-X', 'faulthandler', '-I', '-c', '\nimport os\nfrom test import support\nwith support.temp_cwd() as temp_path:\n pid = os.fork()\n if pid != 0:\n # parent process\n\n # wait for the child to terminate\n support.wait_process(pid, exitcode=0)\n\n # Make sure that temp_path is still present. When the child\n # process leaves the \'temp_cwd\'-context, the __exit__()-\n # method of the context must not remove the temporary\n # directory.\n if not os.path.isdir(temp_path):\n raise AssertionError("Child removed temp_path.")\n']
stdout:
---
---
stderr:
---
(... truncated stderr ...)x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#23 0x4621e8 in _PyFunction_Vectorcall Objects/call.c:396
#24 0x4359d4 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#25 0x4359d4 in PyObject_Vectorcall Include/cpython/abstract.h:127
#26 0x4359d4 in call_function Python/ceval.c:5075
#27 0x4359d4 in _PyEval_EvalFrameDefault Python/ceval.c:3535
#28 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#29 0x42265c in function_code_fastcall Objects/call.c:330
#30 0x463884 in _PyObject_FastCallDictTstate Objects/call.c:118
#31 0x463884 in _PyObject_Call_Prepend Objects/call.c:489
#32 0x540d5d in slot_tp_init Objects/typeobject.c:6964
#33 0x51e8d7 in type_call Objects/typeobject.c:1026
#34 0x45eedc in _PyObject_MakeTpCall Objects/call.c:191
#35 0x437946 in _PyObject_VectorcallTstate Include/cpython/abstract.h:116
#36 0x437946 in _PyObject_VectorcallTstate Include/cpython/abstract.h:103
#37 0x437946 in PyObject_Vectorcall Include/cpython/abstract.h:127
#38 0x437946 in call_function Python/ceval.c:5075
#39 0x437946 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#40 0x5f6ce7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#41 0x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#42 0x5f74e6 in _PyEval_EvalCodeWithName Python/ceval.c:4359
#43 0x5f74e6 in PyEval_EvalCodeEx Python/ceval.c:4375
#44 0x5f74e6 in PyEval_EvalCode Python/ceval.c:826
#45 0x8f9e00 in builtin_exec_impl Python/bltinmodule.c:1026
#46 0x8f9e00 in builtin_exec Python/clinic/bltinmodule.c.h:396
#47 0x87f087 in cfunction_vectorcall_FASTCALL Objects/methodobject.c:430
#48 0x4610ac in PyVectorcall_Call Objects/call.c:231
#49 0x42c932 in do_call_core Python/ceval.c:5123
#50 0x42c932 in _PyEval_EvalFrameDefault Python/ceval.c:3580
#51 0x5f6ce7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#52 0x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#53 0x4621e8 in _PyFunction_Vectorcall Objects/call.c:396
#54 0x437c94 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#55 0x437c94 in PyObject_Vectorcall Include/cpython/abstract.h:127
#56 0x437c94 in call_function Python/ceval.c:5075
#57 0x437c94 in _PyEval_EvalFrameDefault Python/ceval.c:3487
#58 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#59 0x42265c in function_code_fastcall Objects/call.c:330
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7f80ca5b71b7 in __interceptor_malloc (/usr/lib64/libasan.so.6+0xaf1b7)
#1 0x6c416d in PyThread_allocate_lock Python/thread_pthread.h:389
#2 0x7b7535 in newlockobject Modules/_threadmodule.c:577
#3 0x7b7535 in thread__set_sentinel Modules/_threadmodule.c:1278
#4 0x87f3f5 in cfunction_vectorcall_NOARGS Objects/methodobject.c:489
#5 0x436237 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#6 0x436237 in PyObject_Vectorcall Include/cpython/abstract.h:127
#7 0x436237 in call_function Python/ceval.c:5075
#8 0x436237 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#9 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#10 0x42265c in function_code_fastcall Objects/call.c:330
#11 0x438eaf in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#12 0x438eaf in PyObject_Vectorcall Include/cpython/abstract.h:127
#13 0x438eaf in call_function Python/ceval.c:5075
#14 0x438eaf in _PyEval_EvalFrameDefault Python/ceval.c:3504
#15 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#16 0x42265c in function_code_fastcall Objects/call.c:330
#17 0x463884 in _PyObject_FastCallDictTstate Objects/call.c:118
#18 0x463884 in _PyObject_Call_Prepend Objects/call.c:489
#19 0x540d5d in slot_tp_init Objects/typeobject.c:6964
#20 0x51e8d7 in type_call Objects/typeobject.c:1026
#21 0x45eedc in _PyObject_MakeTpCall Objects/call.c:191
#22 0x437946 in _PyObject_VectorcallTstate Include/cpython/abstract.h:116
#23 0x437946 in _PyObject_VectorcallTstate Include/cpython/abstract.h:103
#24 0x437946 in PyObject_Vectorcall Include/cpython/abstract.h:127
#25 0x437946 in call_function Python/ceval.c:5075
#26 0x437946 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#27 0x5f6ce7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#28 0x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#29 0x5f74e6 in _PyEval_EvalCodeWithName Python/ceval.c:4359
#30 0x5f74e6 in PyEval_EvalCodeEx Python/ceval.c:4375
#31 0x5f74e6 in PyEval_EvalCode Python/ceval.c:826
#32 0x8f9e00 in builtin_exec_impl Python/bltinmodule.c:1026
#33 0x8f9e00 in builtin_exec Python/clinic/bltinmodule.c.h:396
#34 0x87f087 in cfunction_vectorcall_FASTCALL Objects/methodobject.c:430
#35 0x4610ac in PyVectorcall_Call Objects/call.c:231
#36 0x42c932 in do_call_core Python/ceval.c:5123
#37 0x42c932 in _PyEval_EvalFrameDefault Python/ceval.c:3580
#38 0x5f6ce7 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#39 0x5f6ce7 in _PyEval_EvalCode Python/ceval.c:4327
#40 0x4621e8 in _PyFunction_Vectorcall Objects/call.c:396
#41 0x437c94 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#42 0x437c94 in PyObject_Vectorcall Include/cpython/abstract.h:127
#43 0x437c94 in call_function Python/ceval.c:5075
#44 0x437c94 in _PyEval_EvalFrameDefault Python/ceval.c:3487
#45 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#46 0x42265c in function_code_fastcall Objects/call.c:330
#47 0x438eaf in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#48 0x438eaf in PyObject_Vectorcall Include/cpython/abstract.h:127
#49 0x438eaf in call_function Python/ceval.c:5075
#50 0x438eaf in _PyEval_EvalFrameDefault Python/ceval.c:3504
#51 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#52 0x42265c in function_code_fastcall Objects/call.c:330
#53 0x436237 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#54 0x436237 in PyObject_Vectorcall Include/cpython/abstract.h:127
#55 0x436237 in call_function Python/ceval.c:5075
#56 0x436237 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#57 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#58 0x42265c in function_code_fastcall Objects/call.c:330
#59 0x436237 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#60 0x436237 in PyObject_Vectorcall Include/cpython/abstract.h:127
#61 0x436237 in call_function Python/ceval.c:5075
#62 0x436237 in _PyEval_EvalFrameDefault Python/ceval.c:3518
#63 0x42265c in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#64 0x42265c in function_code_fastcall Objects/call.c:330
#65 0x45fe2e in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#66 0x45fe2e in object_vacall Objects/call.c:792
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7f80ca5b71b7 in __interceptor_malloc (/usr/lib64/libasan.so.6+0xaf1b7)
#1 0x6c416d in PyThread_allocate_lock Python/thread_pthread.h:389
#2 0x694390 in _PyRuntimeState_Init_impl Python/pystate.c:74
#3 0x694390 in _PyRuntimeState_Init Python/pystate.c:99
#4 0x68f363 in _PyRuntime_Initialize Python/pylifecycle.c:82
#5 0x68f363 in _PyRuntime_Initialize Python/pylifecycle.c:69
#6 0x43f8db in pymain_init Modules/main.c:38
#7 0x442e12 in pymain_main Modules/main.c:698
#8 0x442e12 in Py_BytesMain Modules/main.c:731
#9 0x7f80ca25826f (/usr/lib64/libc.so.6+0x2d26f)
SUMMARY: AddressSanitizer: 192 byte(s) leaked in 6 allocation(s).
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "/root/rpmbuild/BUILD/Python-3.9.9/Lib/test/support/__init__.py", line 3164, in wait_process
raise AssertionError(f"process {pid} exited with code {exitcode2}, "
AssertionError: process 92219 exited with code 1, but exit code 0 is expected
---
test test_support failed
----------------------------------------------------------------------
Ran 2 tests in 6.153s
FAILED (failures=3)
1 test failed again:
test_support
== Tests result: FAILURE then FAILURE ==
1 test failed:
test_support
1 re-run test:
test_support
Total duration: 18.1 sec
Tests result: FAILURE then FAILURE
Have tested Python-3.9.13 with same method, and found following tests report asan issue:
test_embed
test_imp
test_importlib
test_os
test_support
test_thread
test_threading
test_tracemalloc
test_warnings
test_zipimport
Take test_zipimport for example:
localhost:~/cpython-3.9.13 # cat log_test_zipimport
0:00:00 load avg: 0.97 Run tests sequentially
0:00:00 load avg: 0.97 [1/1] test_zipimport
== Tests result: SUCCESS ==
1 test OK.
Total duration: 343 ms
Tests result: SUCCESS
=================================================================
==1200537==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 60 byte(s) in 2 object(s) allocated from:
#0 0xffff50847490 in strdup (/usr/lib64/libasan.so.6+0x57490)
#1 0xffff3dba814c in set_completer_delims /root/cpython-3.9.13/Modules/readline.c:496
#2 0x7c3080 in cfunction_vectorcall_O Objects/methodobject.c:516
#3 0x432770 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#4 0x432770 in PyObject_Vectorcall Include/cpython/abstract.h:127
#5 0x432770 in call_function Python/ceval.c:5077
#6 0x432770 in _PyEval_EvalFrameDefault Python/ceval.c:3489
#7 0x5a8694 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#8 0x5a8694 in _PyEval_EvalCode Python/ceval.c:4329
#9 0x455b00 in _PyFunction_Vectorcall Objects/call.c:396
#10 0x4322e4 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#11 0x4322e4 in PyObject_Vectorcall Include/cpython/abstract.h:127
#12 0x4322e4 in call_function Python/ceval.c:5077
#13 0x4322e4 in _PyEval_EvalFrameDefault Python/ceval.c:3537
#14 0x422448 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#15 0x422448 in function_code_fastcall Objects/call.c:330
#16 0x456d18 in _PyObject_FastCallDictTstate Objects/call.c:118
#17 0x456d18 in _PyObject_Call_Prepend Objects/call.c:489
#18 0x5127b4 in slot_tp_init Objects/typeobject.c:6971
#19 0x4f6fd0 in type_call Objects/typeobject.c:1028
#20 0x453084 in _PyObject_MakeTpCall Objects/call.c:191
#21 0x4328bc in _PyObject_VectorcallTstate Include/cpython/abstract.h:116
#22 0x4328bc in _PyObject_VectorcallTstate Include/cpython/abstract.h:103
#23 0x4328bc in PyObject_Vectorcall Include/cpython/abstract.h:127
#24 0x4328bc in call_function Python/ceval.c:5077
#25 0x4328bc in _PyEval_EvalFrameDefault Python/ceval.c:3520
#26 0x5a8694 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#27 0x5a8694 in _PyEval_EvalCode Python/ceval.c:4329
#28 0x455b00 in _PyFunction_Vectorcall Objects/call.c:396
#29 0x432844 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#30 0x432844 in PyObject_Vectorcall Include/cpython/abstract.h:127
#31 0x432844 in call_function Python/ceval.c:5077
#32 0x432844 in _PyEval_EvalFrameDefault Python/ceval.c:3506
#33 0x5a8694 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#34 0x5a8694 in _PyEval_EvalCode Python/ceval.c:4329
#35 0x455b00 in _PyFunction_Vectorcall Objects/call.c:396
#36 0x4322e4 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#37 0x4322e4 in PyObject_Vectorcall Include/cpython/abstract.h:127
#38 0x4322e4 in call_function Python/ceval.c:5077
#39 0x4322e4 in _PyEval_EvalFrameDefault Python/ceval.c:3537
#40 0x422448 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#41 0x422448 in function_code_fastcall Objects/call.c:330
#42 0x792a14 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#43 0x792a14 in method_vectorcall Objects/classobject.c:53
#44 0x4317c8 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#45 0x4317c8 in PyObject_Vectorcall Include/cpython/abstract.h:127
#46 0x4317c8 in call_function Python/ceval.c:5077
#47 0x4317c8 in _PyEval_EvalFrameDefault Python/ceval.c:3520
#48 0x5a8694 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#49 0x5a8694 in _PyEval_EvalCode Python/ceval.c:4329
#50 0x455b00 in _PyFunction_Vectorcall Objects/call.c:396
#51 0x792a14 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#52 0x792a14 in method_vectorcall Objects/classobject.c:53
#53 0x4322e4 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#54 0x4322e4 in PyObject_Vectorcall Include/cpython/abstract.h:127
#55 0x4322e4 in call_function Python/ceval.c:5077
#56 0x4322e4 in _PyEval_EvalFrameDefault Python/ceval.c:3537
#57 0x422448 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#58 0x422448 in function_code_fastcall Objects/call.c:330
#59 0x432844 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#60 0x432844 in PyObject_Vectorcall Include/cpython/abstract.h:127
#61 0x432844 in call_function Python/ceval.c:5077
#62 0x432844 in _PyEval_EvalFrameDefault Python/ceval.c:3506
#63 0x422448 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#64 0x422448 in function_code_fastcall Objects/call.c:330
#65 0x792a14 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#66 0x792a14 in method_vectorcall Objects/classobject.c:53
Direct leak of 30 byte(s) in 1 object(s) allocated from:
#0 0xffff50847490 in strdup (/usr/lib64/libasan.so.6+0x57490)
#1 0xffff3dba814c in set_completer_delims /root/cpython-3.9.13/Modules/readline.c:496
#2 0x7c3080 in cfunction_vectorcall_O Objects/methodobject.c:516
#3 0x432770 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#4 0x432770 in PyObject_Vectorcall Include/cpython/abstract.h:127
#5 0x432770 in call_function Python/ceval.c:5077
#6 0x432770 in _PyEval_EvalFrameDefault Python/ceval.c:3489
#7 0x5a8694 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#8 0x5a8694 in _PyEval_EvalCode Python/ceval.c:4329
#9 0x455b00 in _PyFunction_Vectorcall Objects/call.c:396
#10 0x4322e4 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#11 0x4322e4 in PyObject_Vectorcall Include/cpython/abstract.h:127
#12 0x4322e4 in call_function Python/ceval.c:5077
#13 0x4322e4 in _PyEval_EvalFrameDefault Python/ceval.c:3537
#14 0x422448 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#15 0x422448 in function_code_fastcall Objects/call.c:330
#16 0x456d18 in _PyObject_FastCallDictTstate Objects/call.c:118
#17 0x456d18 in _PyObject_Call_Prepend Objects/call.c:489
#18 0x5127b4 in slot_tp_init Objects/typeobject.c:6971
#19 0x4f6fd0 in type_call Objects/typeobject.c:1028
#20 0x453084 in _PyObject_MakeTpCall Objects/call.c:191
#21 0x4328bc in _PyObject_VectorcallTstate Include/cpython/abstract.h:116
#22 0x4328bc in _PyObject_VectorcallTstate Include/cpython/abstract.h:103
#23 0x4328bc in PyObject_Vectorcall Include/cpython/abstract.h:127
#24 0x4328bc in call_function Python/ceval.c:5077
#25 0x4328bc in _PyEval_EvalFrameDefault Python/ceval.c:3520
#26 0x5a8694 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#27 0x5a8694 in _PyEval_EvalCode Python/ceval.c:4329
#28 0x455b00 in _PyFunction_Vectorcall Objects/call.c:396
#29 0x792a14 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#30 0x792a14 in method_vectorcall Objects/classobject.c:53
#31 0x4322e4 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#32 0x4322e4 in PyObject_Vectorcall Include/cpython/abstract.h:127
#33 0x4322e4 in call_function Python/ceval.c:5077
#34 0x4322e4 in _PyEval_EvalFrameDefault Python/ceval.c:3537
#35 0x422448 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#36 0x422448 in function_code_fastcall Objects/call.c:330
#37 0x792a14 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#38 0x792a14 in method_vectorcall Objects/classobject.c:53
#39 0x4317c8 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#40 0x4317c8 in PyObject_Vectorcall Include/cpython/abstract.h:127
#41 0x4317c8 in call_function Python/ceval.c:5077
#42 0x4317c8 in _PyEval_EvalFrameDefault Python/ceval.c:3520
#43 0x422448 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#44 0x422448 in function_code_fastcall Objects/call.c:330
#45 0x432844 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#46 0x432844 in PyObject_Vectorcall Include/cpython/abstract.h:127
#47 0x432844 in call_function Python/ceval.c:5077
#48 0x432844 in _PyEval_EvalFrameDefault Python/ceval.c:3506
#49 0x5a8694 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#50 0x5a8694 in _PyEval_EvalCode Python/ceval.c:4329
#51 0x455b00 in _PyFunction_Vectorcall Objects/call.c:396
#52 0x432844 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#53 0x432844 in PyObject_Vectorcall Include/cpython/abstract.h:127
#54 0x432844 in call_function Python/ceval.c:5077
#55 0x432844 in _PyEval_EvalFrameDefault Python/ceval.c:3506
#56 0x422448 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#57 0x422448 in function_code_fastcall Objects/call.c:330
#58 0x792a14 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#59 0x792a14 in method_vectorcall Objects/classobject.c:53
#60 0x4317c8 in _PyObject_VectorcallTstate Include/cpython/abstract.h:118
#61 0x4317c8 in PyObject_Vectorcall Include/cpython/abstract.h:127
#62 0x4317c8 in call_function Python/ceval.c:5077
#63 0x4317c8 in _PyEval_EvalFrameDefault Python/ceval.c:3520
#64 0x5a8694 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:40
#65 0x5a8694 in _PyEval_EvalCode Python/ceval.c:4329
#66 0x455b00 in _PyFunction_Vectorcall Objects/call.c:396
SUMMARY: AddressSanitizer: 90 byte(s) leaked in 3 allocation(s).
We do not consider a minor memory leak on shutdown a security issue. Therefore we will not address the issue or similar issues in 3.9. We would only address the issue if e.g. a function call leaks memory on every call.
The leak in set_completer_delims is a deliberate memory leak. Issue #61491 has more information why we cannot free the memory safely.
Have also tested cpython-3.10.5, and found asan issues in testcases:
test_embed
test_imp
test_importlib
test_logging
test_os
test_ssl
test_support
test_thread
test_threading
test_tracemalloc
test_warnings
test_xxtestfuzz
test_zipimport
Memory leak statistics:
test_imp
SUMMARY: AddressSanitizer: 101 byte(s) leaked in 2 allocation(s).
test_importlib
SUMMARY: AddressSanitizer: 24 byte(s) leaked in 1 allocation(s).
test_logging
SUMMARY: AddressSanitizer: 344 byte(s) leaked in 4 allocation(s). SUMMARY: AddressSanitizer: 344 byte(s) leaked in 4 allocation(s).
test_os
SUMMARY: AddressSanitizer: 160 byte(s) leaked in 5 allocation(s). SUMMARY: AddressSanitizer: 160 byte(s) leaked in 5 allocation(s).
test_ssl
SUMMARY: AddressSanitizer: 180963 byte(s) leaked in 2324 allocation(s).
test_support
SUMMARY: AddressSanitizer: 160 byte(s) leaked in 5 allocation(s). SUMMARY: AddressSanitizer: 160 byte(s) leaked in 5 allocation(s).
test_thread
SUMMARY: AddressSanitizer: 64 byte(s) leaked in 2 allocation(s).
test_threading
SUMMARY: AddressSanitizer: 224 byte(s) leaked in 7 allocation(s). SUMMARY: AddressSanitizer: 91400 byte(s) leaked in 344 allocation(s). SUMMARY: AddressSanitizer: 224 byte(s) leaked in 7 allocation(s). SUMMARY: AddressSanitizer: 224 byte(s) leaked in 7 allocation(s). SUMMARY: AddressSanitizer: 91288 byte(s) leaked in 336 allocation(s). SUMMARY: AddressSanitizer: 224 byte(s) leaked in 7 allocation(s). SUMMARY: AddressSanitizer: 96 byte(s) leaked in 3 allocation(s).
test_tracemalloc
SUMMARY: AddressSanitizer: 940116 byte(s) leaked in 7260 allocation(s). SUMMARY: AddressSanitizer: 94776 byte(s) leaked in 3949 allocation(s). SUMMARY: AddressSanitizer: 28632 byte(s) leaked in 1193 allocation(s). SUMMARY: AddressSanitizer: 93264 byte(s) leaked in 3886 allocation(s). SUMMARY: AddressSanitizer: 93264 byte(s) leaked in 3886 allocation(s). SUMMARY: AddressSanitizer: 1290732 byte(s) leaked in 7177 allocation(s). SUMMARY: AddressSanitizer: 940116 byte(s) leaked in 7260 allocation(s). SUMMARY: AddressSanitizer: 94776 byte(s) leaked in 3949 allocation(s). SUMMARY: AddressSanitizer: 28632 byte(s) leaked in 1193 allocation(s). SUMMARY: AddressSanitizer: 93264 byte(s) leaked in 3886 allocation(s). SUMMARY: AddressSanitizer: 93264 byte(s) leaked in 3886 allocation(s). SUMMARY: AddressSanitizer: 1290732 byte(s) leaked in 7177 allocation(s). SUMMARY: AddressSanitizer: 19308 byte(s) leaked in 470 allocation(s).
test_warnings
SUMMARY: AddressSanitizer: 154284 byte(s) leaked in 4289 allocation(s). SUMMARY: AddressSanitizer: 154284 byte(s) leaked in 4289 allocation(s).
test_xxtestfuzz
SUMMARY: AddressSanitizer: 28 byte(s) leaked in 1 allocation(s).
test_zipimport
SUMMARY: AddressSanitizer: 90 byte(s) leaked in 3 allocation(s).
e.g. log of test_thread:
0:00:00 load avg: 1.02 Run tests sequentially
0:00:00 load avg: 1.02 [1/1] test_thread
== Tests result: SUCCESS ==
1 test OK.
Total duration: 786 ms
Tests result: SUCCESS
=================================================================
==1365600==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 64 byte(s) in 2 object(s) allocated from:
#0 0xffff4a1c5034 in malloc (/usr/lib64/libasan.so.6+0xa5034)
#1 0x68094c in PyThread_allocate_lock Python/thread_pthread.h:392
#2 0x747fbc in newlockobject Modules/_threadmodule.c:613
#3 0x747fbc in thread_PyThread_allocate_lock Modules/_threadmodule.c:1226
#4 0x8017c4 in cfunction_vectorcall_NOARGS Objects/methodobject.c:489
#5 0x432ec0 in _PyObject_VectorcallTstate Include/cpython/abstract.h:114
#6 0x432ec0 in PyObject_Vectorcall Include/cpython/abstract.h:123
#7 0x432ec0 in call_function Python/ceval.c:5869
#8 0x432ec0 in _PyEval_EvalFrameDefault Python/ceval.c:4181
#9 0x5c4624 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#10 0x5c4624 in _PyEval_Vector Python/ceval.c:5065
#11 0x7c8584 in _PyObject_VectorcallTstate Include/cpython/abstract.h:114
#12 0x7c8584 in method_vectorcall Objects/classobject.c:53
#13 0x42facc in _PyObject_VectorcallTstate Include/cpython/abstract.h:114
#14 0x42facc in PyObject_Vectorcall Include/cpython/abstract.h:123
#15 0x42facc in call_function Python/ceval.c:5869
#16 0x42facc in _PyEval_EvalFrameDefault Python/ceval.c:4213
#17 0x5c4624 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#18 0x5c4624 in _PyEval_Vector Python/ceval.c:5065
#19 0x4320cc in _PyObject_VectorcallTstate Include/cpython/abstract.h:114
#20 0x4320cc in PyObject_Vectorcall Include/cpython/abstract.h:123
#21 0x4320cc in call_function Python/ceval.c:5869
#22 0x4320cc in _PyEval_EvalFrameDefault Python/ceval.c:4198
#23 0x5c4624 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#24 0x5c4624 in _PyEval_Vector Python/ceval.c:5065
#25 0x7c8460 in _PyObject_VectorcallTstate Include/cpython/abstract.h:114
#26 0x7c8460 in method_vectorcall Objects/classobject.c:83
#27 0x45d7e4 in PyVectorcall_Call Objects/call.c:255
#28 0x42955c in do_call_core Python/ceval.c:5921
#29 0x42955c in _PyEval_EvalFrameDefault Python/ceval.c:4277
#30 0x5c4624 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#31 0x5c4624 in _PyEval_Vector Python/ceval.c:5065
#32 0x45f364 in _PyObject_FastCallDictTstate Objects/call.c:142
#33 0x45f364 in _PyObject_Call_Prepend Objects/call.c:431
#34 0x50ca0c in slot_tp_call Objects/typeobject.c:7491
#35 0x45bc58 in _PyObject_MakeTpCall Objects/call.c:215
#36 0x433310 in _PyObject_VectorcallTstate Include/cpython/abstract.h:112
#37 0x433310 in _PyObject_VectorcallTstate Include/cpython/abstract.h:99
#38 0x433310 in PyObject_Vectorcall Include/cpython/abstract.h:123
#39 0x433310 in call_function Python/ceval.c:5869
#40 0x433310 in _PyEval_EvalFrameDefault Python/ceval.c:4213
#41 0x5c4624 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#42 0x5c4624 in _PyEval_Vector Python/ceval.c:5065
#43 0x7c8460 in _PyObject_VectorcallTstate Include/cpython/abstract.h:114
#44 0x7c8460 in method_vectorcall Objects/classobject.c:83
#45 0x45d7e4 in PyVectorcall_Call Objects/call.c:255
#46 0x42955c in do_call_core Python/ceval.c:5921
#47 0x42955c in _PyEval_EvalFrameDefault Python/ceval.c:4277
#48 0x5c4624 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#49 0x5c4624 in _PyEval_Vector Python/ceval.c:5065
#50 0x45f364 in _PyObject_FastCallDictTstate Objects/call.c:142
#51 0x45f364 in _PyObject_Call_Prepend Objects/call.c:431
#52 0x50ca0c in slot_tp_call Objects/typeobject.c:7491
#53 0x45bc58 in _PyObject_MakeTpCall Objects/call.c:215
#54 0x433310 in _PyObject_VectorcallTstate Include/cpython/abstract.h:112
#55 0x433310 in _PyObject_VectorcallTstate Include/cpython/abstract.h:99
#56 0x433310 in PyObject_Vectorcall Include/cpython/abstract.h:123
#57 0x433310 in call_function Python/ceval.c:5869
#58 0x433310 in _PyEval_EvalFrameDefault Python/ceval.c:4213
#59 0x5c4624 in _PyEval_EvalFrame Include/internal/pycore_ceval.h:46
#60 0x5c4624 in _PyEval_Vector Python/ceval.c:5065
#61 0x7c8460 in _PyObject_VectorcallTstate Include/cpython/abstract.h:114
#62 0x7c8460 in method_vectorcall Objects/classobject.c:83
SUMMARY: AddressSanitizer: 64 byte(s) leaked in 2 allocation(s).
We do not consider a minor memory leak on shutdown a security issue. Therefore we will not address the issue or similar issues in 3.9. We would only address the issue if e.g. a function call leaks memory on every call.
The leak in set_completer_delims is a deliberate memory leak. Issue #61491 has more information why we cannot free the memory safely.
I am not sure whether the memory leak only occurs on shutdown or only happen once.
Could you please give me any guidance about how to confirm the memory leak point(which function call causes it) and its frequency from the log?
I recommend that you start a new ticket and investigate the tip of the main branch. Even Python 3.10 does not free all memory on shutdown. 3.11 and main should free all memory on shutdown except for well-documented cases like set_completer_delims. We cannot backport the fixes to 3.10 because they may introduce backwards incompatibilities.
Activity
he7850 commentedon Jun 21, 2022
part of log (e.g. test_support)
zware commentedon Jun 21, 2022
3.9 is now in security maintenance, and is already at v3.9.13 anyway. Can you reproduce this with v3.10.5 or v3.11.0b3?
he7850 commentedon Jun 24, 2022
Have tested Python-3.9.13 with same method, and found following tests report asan issue:
test_embed
test_imp
test_importlib
test_os
test_support
test_thread
test_threading
test_tracemalloc
test_warnings
test_zipimport
Take test_zipimport for example:
tiran commentedon Jun 24, 2022
We do not consider a minor memory leak on shutdown a security issue. Therefore we will not address the issue or similar issues in 3.9. We would only address the issue if e.g. a function call leaks memory on every call.
The leak in
set_completer_delimsis a deliberate memory leak. Issue #61491 has more information why we cannot free the memory safely.he7850 commentedon Jun 24, 2022
Have also tested cpython-3.10.5, and found asan issues in testcases:
test_embed
test_imp
test_importlib
test_logging
test_os
test_ssl
test_support
test_thread
test_threading
test_tracemalloc
test_warnings
test_xxtestfuzz
test_zipimport
Memory leak statistics:
e.g. log of test_thread:
he7850 commentedon Jun 24, 2022
I am not sure whether the memory leak only occurs on shutdown or only happen once.
Could you please give me any guidance about how to confirm the memory leak point(which function call causes it) and its frequency from the log?
Thanks!
tiran commentedon Jun 24, 2022
I recommend that you start a new ticket and investigate the tip of the main branch. Even Python 3.10 does not free all memory on shutdown. 3.11 and main should free all memory on shutdown except for well-documented cases like
set_completer_delims. We cannot backport the fixes to 3.10 because they may introduce backwards incompatibilities.kumaraditya303 commentedon Jul 12, 2022
Please create a new report based on main branch. Thanks!