-
Notifications
You must be signed in to change notification settings - Fork 53
Description
The goal of the issue is to solve all the issues reported by the ASAN build, see this one as an example of the Harmonic problems.
Why This Task Matters
Memory problems reported by the AddressSanitizer tools are severe issues that can end up in different kind of problems for the users some of them really hard to debug since the issues affects to the memory used by the applications.
Who Can Contribute
No previous experience on Gazebo is required. To work on the issue anyone just need solid fundamentals of C++ code.
Step-by-Step Task Plan
Although there are problems reported in different branches of gz-common, if you don't know which one to pick we can go with gz-common5 that is included in Gazebo Harmonic .
- Create the development environment: according to the main page of Harmonic, the distribution is supported on Ubuntu Noble and Ubuntu Jammy. If you are using a different operative system or distribution, probably the best way is to use the official Ubuntu docker images for these distributions.
- Installing the dependencies: follow the install instructions in gz-common5 until running
sudo apt install libgz-common5-dev(more preciselysudo apt build-dep libgz-common5-devbut both should work). - Compiling from source and test to reproduce the problem:
- Run
export ASAN_OPTIONS=check_initialization_order=true:strict_init_order=truein the terminal dedicated to the compilation. - Two build options:
- Easiest would be to follow the"Build from Source" >> "Ubuntu" in the gz-common5 instructions. https://gazebosim.org/api/common/5/install.html. Using the gz-cmake sanitizer support should work by calling
cmake .. -DGZ_SANITIZER=Addressinstead of justcmake ... Be sure of running the test - If you are familiar with colcon and vcs tools, you can use the gz-common5.yaml file to create the colcon workspace and follow the sanitizers instructions in the gazebo contributing.
- Easiest would be to follow the"Build from Source" >> "Ubuntu" in the gz-common5 instructions. https://gazebosim.org/api/common/5/install.html. Using the gz-cmake sanitizer support should work by calling
- Detecting ASAN errors: in the test log you will see some messages and backtraces ```==3907==ERROR: LeakSanitizer: detected memory leaks
orDirect leak of 106064 byte(s) in 4 object(s) allocated from:` that should point you into the right direction about where the problems comes from.
- Run
- Create a pull request: once you have modified the code to resolve the problems displayed by asan, please open a pull request against the gz-common5 branch. Follow the contributing guide from point 5.
What You Will Learn
Memory bug hunting in C++ is a serious developer task well recognized by anyone using the programming language. The 'journey' will also give you a hint about what classes and features we support in gz-common that can be shared with other code outside of Gazebo libs.
Communications
- For problems related to setup the workspace to work, you can use this issue.
- To submit your changes open your own PR and follow up there.
- For other general questions, please use the #gazebo-general channel in the OSRF discord prefixing the message with [weekly-contributions] and a mention to @jrivero.