Skip to content

Accessing MjsTendonPath.MjsWrap Python bindings causes a segfault with a body/attach model #3152

@LouRohanNV

Description

@LouRohanNV

Intro

We are working on the mujoco-usd-converter.

My setup

MuJoCo 3.5.0, Python, Windows and Linux

What's happening? What did you expect?

Segfault when accessing tendons through the python bindings on a model that is included using body/attach.

Accessing the MjsWrap objects from MjsTendonPath in the Python bindings causes a segfault when the model was loaded via <attach>.

I found this when trying to iterate over the tendon path in the softfoot model from within scene.xml from https://github.com/google-deepmind/mujoco_menagerie/tree/main/iit_softfoot

Steps for reproduction

I've attached a shell script and python program that will segfault:
mujoco_tendon_repro.zip

setup_and_run.sh -- the entry point:

  1. Creates a .venv virtual environment using uv venv
  2. Installs mujoco>=3.5.0 via uv pip install
  3. Downloads only the iit_softfoot directory from mujoco_menagerie using a sparse git checkout (avoids cloning the full repo)
  4. Runs the Python repro script

repro_tendon_bug.py -- the reproduction:

  1. Loads softfoot.xml directly via MjSpec.from_file(), compiles it, and iterates over all tendons/path waypoints -- proving the model itself is valid
  2. Loads scene.xml (which includes the softfoot via <attach/>), then does the same iteration
  3. For each waypoint, attempts to access wp.target.name -- this is where the crash should occur due to the Python bindings bug

To run it:

cd /home/lrohan/dev/mujoco_tendon_repro
./setup_and_run.sh

Minimal model for reproduction

The repro zip/script will download the softfoot scene from the MuJoCo Menagerie.

Code required for reproduction

The repro zip/script contains the Python code.

Confirmations

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions