google-deepmind / google-deepmind/mujoco_mpc
ModelDerivatives::Compute makes thread-unsafe call to mj_transitionFD
Open
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 282
- PR merge metrics
- No merged PRs in 30d
Description
Here: https://github.com/google-deepmind/mujoco_mpc/blob/79db2bc0cc8e1ca4e96af0859718c265cdd22caf/mjpc/planners/model_derivatives.cc#L96
multiple threads are calling `mjd_transitionFD` on the same `mjData` instance. Unfortunately, `mjd_transitionFD` takes a **non-const** `mjData*`, and performs MuJoCo stack allocations. Those allocations are not thread safe and will get mixed up between threads, so the resulting computation is likely nonsense.
This was discovered by running tests with ThreadSanitizer.
Contributor guide
Assessment
This issue has not been assessed yet.