Open
Description
This got reported within SONiC when testing Trixie containers. We have some patches applied that aren't upstream, so I tested on a Trixie RC2 VM without any patches to confirm that it does indeed have a problem. Trixie comes with Libyang 3.12.2.
Here are the exact steps to reproduce:
sudo apt-get install -y cmake git build-essential tox python3-pytest python3-setuptools python3-pip python3-venv valgrind && \
sudo apt-get install -y libyang-dev && \
git clone https://github.com/CESNET/libyang-python && \
cd libyang-python && \
python3 -m venv venv && \
source venv/bin/activate && \
pip3 install -e . && \
valgrind pytest -vv
We end up with this output:
========================================================================================= test session starts =========================================================================================
platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.5.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/brad/libyang-python
configfile: pyproject.toml
plugins: typeguard-4.4.2
collected 149 items
tests/test_context.py::ContextTest::test_context_dict PASSED [ 0%]
tests/test_context.py::ContextTest::test_ctx_dir PASSED [ 1%]
tests/test_context.py::ContextTest::test_ctx_disable_searchdirs PASSED [ 2%]
tests/test_context.py::ContextTest::test_ctx_duplicate_searchpath PASSED [ 2%]
tests/test_context.py::ContextTest::test_ctx_env_search_dir PASSED [ 3%]
tests/test_context.py::ContextTest::test_ctx_find_path PASSED [ 4%]
tests/test_context.py::ContextTest::test_ctx_get_invalid_module PASSED [ 4%]
tests/test_context.py::ContextTest::test_ctx_get_module PASSED [ 5%]
tests/test_context.py::ContextTest::test_ctx_invalid_dir PASSED [ 6%]
tests/test_context.py::ContextTest::test_ctx_iter_modules PASSED [ 6%]
tests/test_context.py::ContextTest::test_ctx_leafref_extended PASSED [ 7%]
tests/test_context.py::ContextTest::test_ctx_load_invalid_module PASSED [ 8%]
tests/test_context.py::ContextTest::test_ctx_load_module PASSED [ 8%]
tests/test_context.py::ContextTest::test_ctx_load_module_with_features PASSED [ 9%]
tests/test_context.py::ContextTest::test_ctx_missing_dir PASSED [ 10%]
tests/test_context.py::ContextTest::test_ctx_no_dir PASSED [ 10%]
tests/test_context.py::ContextTest::test_ctx_parse_module PASSED [ 11%]
tests/test_context.py::ContextTest::test_ctx_using_clb PASSED [ 12%]
tests/test_context.py::ContextTest::test_ctx_yanglib PASSED [ 12%]
tests/test_data.py::DataTest::test_add_defaults PASSED [ 13%]
tests/test_data.py::DataTest::test_data_add_path PASSED [ 14%]
tests/test_data.py::DataTest::test_data_create_invalid_regexp PASSED [ 14%]
tests/test_data.py::DataTest::test_data_create_invalid_type PASSED [ 15%]
tests/test_data.py::DataTest::test_data_create_paths PASSED [ 16%]
tests/test_data.py::DataTest::test_data_diff PASSED [ 16%]
tests/test_data.py::DataTest::test_data_from_dict_action PASSED [ 17%]
tests/test_data.py::DataTest::test_data_from_dict_container PASSED [ 18%]
tests/test_data.py::DataTest::test_data_from_dict_invalid PASSED [ 18%]
tests/test_data.py::DataTest::test_data_from_dict_leaf PASSED [ 19%]
tests/test_data.py::DataTest::test_data_from_dict_module PASSED [ 20%]
tests/test_data.py::DataTest::test_data_from_dict_module_free_func PASSED [ 20%]
tests/test_data.py::DataTest::test_data_from_dict_module_with_prefix PASSED [ 21%]
tests/test_data.py::DataTest::test_data_from_dict_rpc PASSED [ 22%]
tests/test_data.py::DataTest::test_data_parse_anyxml PASSED [ 22%]
tests/test_data.py::DataTest::test_data_parse_config_json PASSED [ 23%]
tests/test_data.py::DataTest::test_data_parse_config_json_file PASSED [ 24%]
tests/test_data.py::DataTest::test_data_parse_config_json_without_yang_lib PASSED [ 24%]
tests/test_data.py::DataTest::test_data_parse_config_xml PASSED [ 25%]
tests/test_data.py::DataTest::test_data_parse_config_xml_multi_error PASSED [ 26%]
tests/test_data.py::DataTest::test_data_parse_data_xml PASSED [ 26%]
tests/test_data.py::DataTest::test_data_parse_netconf PASSED [ 27%]
tests/test_data.py::DataTest::test_data_parse_state_json PASSED [ 28%]
tests/test_data.py::DataTest::test_data_to_dict_action PASSED [ 28%]
tests/test_data.py::DataTest::test_data_to_dict_config PASSED [ 29%]
tests/test_data.py::DataTest::test_data_to_dict_keyless_list PASSED [ 30%]
tests/test_data.py::DataTest::test_data_to_dict_rpc_input PASSED [ 30%]
tests/test_data.py::DataTest::test_dnode_attrs PASSED [ 31%]
tests/test_data.py::DataTest::test_dnode_attrs__contains PASSED [ 32%]
tests/test_data.py::DataTest::test_dnode_attrs__len PASSED [ 32%]
tests/test_data.py::DataTest::test_dnode_attrs_get PASSED [ 33%]
tests/test_data.py::DataTest::test_dnode_attrs_remove PASSED [ 34%]
tests/test_data.py::DataTest::test_dnode_attrs_set PASSED [ 34%]
tests/test_data.py::DataTest::test_dnode_attrs_set_and_remove_multiple PASSED [ 35%]
tests/test_data.py::DataTest::test_dnode_builtin_plugins_only PASSED [ 36%]
tests/test_data.py::DataTest::test_dnode_double_free PASSED [ 36%]
tests/test_data.py::DataTest::test_dnode_insert_sibling PASSED [ 37%]
tests/test_data.py::DataTest::test_dnode_insert_sibling_before_after PASSED [ 38%]
tests/test_data.py::DataTest::test_dnode_leafref_linking PASSED [ 38%]
tests/test_data.py::DataTest::test_dnode_new_opaq_find_one PASSED [ 39%]
tests/test_data.py::DataTest::test_dnode_parse_json_null PASSED [ 40%]
tests/test_data.py::DataTest::test_dnode_store_only PASSED [ 40%]
tests/test_data.py::DataTest::test_dnode_unlink PASSED [ 41%]
tests/test_data.py::DataTest::test_find_all PASSED [ 42%]
tests/test_data.py::DataTest::test_find_one PASSED [ 42%]
tests/test_data.py::DataTest::test_iter_tree PASSED [ 43%]
tests/test_data.py::DataTest::test_merge_builtin_plugins_only PASSED [ 44%]
tests/test_data.py::DataTest::test_merge_store_only PASSED [ 44%]
tests/test_data.py::DataTest::test_notification_from_dict_module PASSED [ 45%]
tests/test_diff.py::DiffTest::test_diff PASSED [ 46%]
tests/test_extension.py::ExtensionTest::test_extension_basic PASSED [ 46%]
tests/test_extension.py::ExtensionTest::test_extension_invalid_compile PASSED [ 47%]
tests/test_extension.py::ExtensionTest::test_extension_invalid_parse PASSED [ 48%]
tests/test_extension.py::ExtensionExampleTest::test_compile_validation_example PASSED [ 48%]
tests/test_extension.py::ExtensionExampleTest::test_parse_validation_example PASSED [ 49%]
tests/test_keyedlist.py::KeyedListTest::test_keylist_base PASSED [ 50%]
tests/test_keyedlist.py::KeyedListTest::test_keylist_leaflist PASSED [ 51%]
tests/test_keyedlist.py::KeyedListTest::test_keylist_list_multiple_keys PASSED [ 51%]
tests/test_keyedlist.py::KeyedListTest::test_keylist_list_one_key PASSED [ 52%]
tests/test_schema.py::ModuleTest::test_mod_attrs PASSED [ 53%]
tests/test_schema.py::ModuleTest::test_mod_children_rpcs PASSED [ 53%]
tests/test_schema.py::ModuleTest::test_mod_enable_features PASSED [ 54%]
tests/test_schema.py::ModuleTest::test_mod_features PASSED [ 55%]
tests/test_schema.py::ModuleTest::test_mod_filepath PASSED [ 55%]
tests/test_schema.py::ModuleTest::test_mod_get_feature PASSED [ 56%]
tests/test_schema.py::ModuleTest::test_mod_get_feature_not_found PASSED [ 57%]
tests/test_schema.py::ModuleTest::test_mod_imports PASSED [ 57%]
tests/test_schema.py::ModuleTest::test_mod_iter PASSED [ 58%]
tests/test_schema.py::ModuleTest::test_mod_print_mem PASSED [ 59%]
tests/test_schema.py::ModuleTest::test_mod_revisions PASSED [ 59%]
tests/test_schema.py::RevisionTest::test_rev_date PASSED [ 60%]
tests/test_schema.py::RevisionTest::test_rev_description PASSED [ 61%]
tests/test_schema.py::RevisionTest::test_rev_extensions PASSED [ 61%]
tests/test_schema.py::RevisionTest::test_rev_reference PASSED [ 62%]
tests/test_schema.py::IfFeatureTest::test_iffeature_dump PASSED [ 63%]
tests/test_schema.py::IfFeatureTest::test_iffeature_state Fatal Python error: Segmentation fault
Current thread 0x00007fb013603100 (most recent call first):
File "/home/brad/libyang-python/libyang/schema.py", line 105 in features
File "/home/brad/libyang-python/libyang/schema.py", line 1381 in if_features
File "/home/brad/libyang-python/tests/test_schema.py", line 226 in test_iffeature_state
File "/usr/lib/python3.13/unittest/case.py", line 606 in _callTestMethod
File "/usr/lib/python3.13/unittest/case.py", line 651 in run
File "/usr/lib/python3.13/unittest/case.py", line 707 in __call__
File "/usr/lib/python3/dist-packages/_pytest/unittest.py", line 351 in runtest
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 174 in pytest_runtest_call
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 103 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 513 in __call__
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 242 in <lambda>
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 341 in from_call
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 241 in call_and_report
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 132 in runtestprotocol
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 113 in pytest_runtest_protocol
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 103 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 513 in __call__
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 362 in pytest_runtestloop
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 103 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 513 in __call__
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 337 in _main
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 283 in wrap_session
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 330 in pytest_cmdline_main
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 103 in _multicall
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120 in _hookexec
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 513 in __call__
File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 175 in main
File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 201 in console_main
File "/usr/bin/pytest", line 8 in <module>
Extension modules: _cffi_backend (total: 1)
Segmentation fault
==17883== Invalid read of size 8
==17883== at 0x849C475: ??? (in /usr/lib/python3/dist-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so)
==17883== by 0x549EF1: PyObject_GetAttr (in /usr/bin/python3.13)
==17883== by 0x55D542: _PyEval_EvalFrameDefault (in /usr/bin/python3.13)
==17883== by 0x5F941A: ??? (in /usr/bin/python3.13)
==17883== by 0x587CBD: ??? (in /usr/bin/python3.13)
==17883== by 0x5499A1: PyObject_Vectorcall (in /usr/bin/python3.13)
==17883== by 0x55F626: _PyEval_EvalFrameDefault (in /usr/bin/python3.13)
==17883== by 0x5C3149: ??? (in /usr/bin/python3.13)
==17883== by 0x5A48C4: ??? (in /usr/bin/python3.13)
==17883== by 0x560FED: _PyEval_EvalFrameDefault (in /usr/bin/python3.13)
==17883== by 0x64B911: ??? (in /usr/bin/python3.13)
==17883== by 0x69EC9F: ??? (in /usr/bin/python3.13)
==17883== Address 0x6bd8b68 is 8 bytes inside a block of size 120 free'd
==17883== at 0x484787F: free (vg_replace_malloc.c:989)
==17883== by 0x82EB64F: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82EBAAA: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82EC13E: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82C68C9: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82C6A3D: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82E4479: lys_set_implemented (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x824EEF8: _cffi_f_lys_set_implemented (_libyang.c:7932)
==17883== by 0x583ACF: ??? (in /usr/bin/python3.13)
==17883== by 0x543ACA: _PyObject_MakeTpCall (in /usr/bin/python3.13)
==17883== by 0x55E051: _PyEval_EvalFrameDefault (in /usr/bin/python3.13)
==17883== by 0x5C3149: ??? (in /usr/bin/python3.13)
==17883== Block was alloc'd at
==17883== at 0x484BBA3: calloc (vg_replace_malloc.c:1675)
==17883== by 0x82CF88E: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82D00D9: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82D0788: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82D3346: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82CF268: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82CF820: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82C3A46: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82C68DE: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82C6A3D: ??? (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x82E4479: lys_set_implemented (in /usr/lib/x86_64-linux-gnu/libyang.so.3.9.1)
==17883== by 0x824EEF8: _cffi_f_lys_set_implemented (_libyang.c:7932)
==17883==
I haven't had a chance to dig into this yet. And it doesn't seem likely that it would be specific to Trixie in any way, and I haven't specifically tried running the tests through valgrind on another platform. Maybe somehow specific to garbage collection handling on a newer python? Trixie has 3.13.3.
Metadata
Metadata
Assignees
Labels
No labels