Fix a race condition in launch_passive and launch_repl.

Before this change, these functions can return before an internal call to `mj_forward`, which results in a race condition if the user script then tries to modify the physics state.

Fixes #783
Fixes #790

PiperOrigin-RevId: 523214378
Change-Id: I8a4c6cef0f5d3ec781fd2c5cae3c20dd4b8be67f
This commit is contained in:
Saran Tunyasuvunakool
2023-04-10 14:35:12 -07:00
committed by Copybara-Service
parent 6d63e046fd
commit 34226bf52d
2 changed files with 11 additions and 1 deletions
+5
View File
@@ -26,6 +26,11 @@ Python bindings
- Offscreen rendering on macOS is no longer restricted to the main thread. This is achieved by using the low-level
Core OpenGL (CGL) API to create the OpenGL context, rather than going via GLFW which relies on Cocoa's NSOpenGL.
The resulting context is not tied to a Cocoa window, and is therefore not tied to the main thread.
- Fixed a race condition in ``viewer.launch_passive`` and ``viewer.launch_repl``. These functions could previously
return before an internal call to ``mj_forward``. This allows user code to continue and potentially modify physics
state concurrently with the internal ``mj_forward``, resulting in e.g.
`MuJoCo stack overflow error<https://github.com/deepmind/mujoco/issues/783>`_
or `segmentation fault<https://github.com/deepmind/mujoco/issues/790>`_.
Bug fixes
^^^^^^^^^