yarp
yarp copied to clipboard
Unable to use list<list<double>> and map<string, list<list<double>>> in a custom thrift message
Describe the bug
In the context of defining a custom message for logging data, I defined a message containing map<string, list<list<double>>> in https://github.com/ami-iit/bipedal-locomotion-framework/commit/6947e1d8c907ce611020368e36a4b5dc581d7233
The code compiles without any problem; however, when I try to use it — for example, by printing the contents of the message with toString() — I get the following error:
Reader failed, unrecognized object code 0
To better investigate the problem, I tried to simply modify a YARP test to be able to replicate the problem.
The code can be found here: https://github.com/GiulioRomualdi/yarp/commit/fb2a517327ed4c1c7f98b2a6e6cd34356fe85d64
I added
list<list<double>> a_list_of_list_of_double,
map<string, list<double>> a_map_of_list_of_double,
map<string, list<list<double>>> a_map_of_list_of_list_of_double,
in the ydl test. map<string, list<double>> a_map_of_list_of_double works without any problem while the others not
To Reproduce Compile https://github.com/GiulioRomualdi/yarp/commit/fb2a517327ed4c1c7f98b2a6e6cd34356fe85d64 with the test enabled and then run
ctest -R idl::thrift::demo::run --output-on-failure
Expected behavior The test should pass without problem
Screenshots
Given the test I wrote the test fails with SegFault
Start 1: demo::yarp_idl_to_dir::IdlThriftTest
1/2 Test #1: demo::yarp_idl_to_dir::IdlThriftTest ...***Exception: SegFault 1.26 sec
Start 2: demo::yarp_add_idl::IdlThriftTest
2/2 Test #2: demo::yarp_add_idl::IdlThriftTest ......***Exception: SegFault 1.25 sec
Configuration (please complete the following information):
- OS: Ubuntu 24.04
- yarp version: yarp 3.10
- compiler: gcc version 13.3.0 (conda-forge gcc 13.3.0-2)
Additional context Add any other context about the problem here.
The failure of the test is the following
/home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/tests/yarpidl_thrift/demo/main.cpp:876: FAILED:
CHECK( b.a_list_of_list_of_double[0][1] == a.a_list_of_list_of_double[0][1] )
with expansion:
0.0 == 0.64
/home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/tests/yarpidl_thrift/demo/main.cpp:877: FAILED:
CHECK( b.a_list_of_list_of_double[1].size() == a.a_list_of_list_of_double[1].size() )
with expansion:
0 == 2
Thread 1 "demo_yarp_add_i" received signal SIGSEGV, Segmentation fault.
0x000055555559fc99 in CATCH2_INTERNAL_TEST_13 ()
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/tests/yarpidl_thrift/demo/main.cpp:878
warning: Source file is more recent than executable.
878 CHECK(b.a_list_of_list_of_double[0][0] == a.a_list_of_list_of_double[0][0]);
(gdb) where
#0 0x000055555559fc99 in CATCH2_INTERNAL_TEST_13 ()
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/tests/yarpidl_thrift/demo/main.cpp:878
#1 0x00005555555e0f7a in Catch::(anonymous namespace)::TestInvokerAsFunction::invoke (
this=<optimized out>)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.cpp:6571
#2 Catch::TestCaseHandle::invoke (this=<optimized out>)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.hpp:7210
#3 Catch::RunContext::invokeActiveTestCase (this=0x7fffffffa9c0)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.cpp:5613
#4 0x000055555561a061 in Catch::RunContext::runCurrentTest (this=this@entry=0x7fffffffa9c0,
redirectedCout=..., redirectedCerr=...)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.cpp:5576
#5 0x000055555561a50f in Catch::RunContext::runTest (this=this@entry=0x7fffffffa9c0,
testCase=...)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.cpp:5300
#6 0x000055555561ec4d in Catch::(anonymous namespace)::TestGroup::execute (
this=0x7fffffffa9b0)
--Type <RET> for more, q to quit, c to continue without paging--
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.cpp:1102
#7 Catch::Session::runInternal (this=this@entry=0x7fffffffac40)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.cpp:1324
#8 0x000055555561f07a in Catch::Session::run (this=this@entry=0x7fffffffac40)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.cpp:1255
#9 0x00005555555859bb in Catch::Session::run<char> (argv=0x7fffffffaf18, argc=1,
this=0x7fffffffac40)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.hpp:5166
#10 Catch::Session::run<char> (argv=0x7fffffffaf18, argc=1, this=0x7fffffffac40)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/extern/catch2/catch2/catch_amalgamated.hpp:5161
#11 main (argc=1, argv=0x7fffffffaf18)
at /home/gromualdi-iit.local/robot-code/robotology-superbuild/src/YARP/tests/yarpidl_thrift/demo/main.cpp:1171
cc @traversaro