Skip to content

Fix DDS init on modern kernels: idempotent ChannelFactory.Init + relax cyclonedds pin - #182

Open
PhysicistJohn wants to merge 1 commit into
NVlabs:mainfrom
PhysicistJohn:fix-dds-init-modern-cyclonedds
Open

Fix DDS init on modern kernels: idempotent ChannelFactory.Init + relax cyclonedds pin#182
PhysicistJohn wants to merge 1 commit into
NVlabs:mainfrom
PhysicistJohn:fix-dds-init-modern-cyclonedds

Conversation

@PhysicistJohn

@PhysicistJohn PhysicistJohn commented Jun 12, 2026

Copy link
Copy Markdown

Problem

On Ubuntu 24.04 (kernel 6.x), gear_sonic/scripts/run_sim_loop.py fails at DDS initialization in two stacked ways:

  1. cyclonedds 0.10.2 hangs. The pinned cyclonedds==0.10.2 wheel's Domain creation blocks indefinitely on recent kernels — the sim loop stalls at ChannelFactoryInitialize with no error output.

  2. Double init raises on cyclonedds ≥ 11. After upgrading cyclonedds, a second failure surfaces: the sim loop initializes the channel factory from both the control-loop side and the simulator side of the same process, and cyclonedds ≥ 11 refuses to re-create a live Domain:

from unitree_sdk2py.core.channel import ChannelFactoryInitialize
ChannelFactoryInitialize(0, 'lo')   # ok
ChannelFactoryInitialize(0, 'lo')   # [ChannelFactory] create domain error.
                                    # msg: Occurred upon initialisation of a cyclonedds.domain.Domain

Fix

  • ChannelFactory.Init returns early when the domain is already live — the class is already a Singleton, so a second Init in-process is safe to treat as a no-op.
  • Relax the vendored SDK's pin to cyclonedds>=0.10.2,<12. The SDK runs unmodified against cyclonedds 11.x (verified: pub/sub on rt/lowstate/rt/lowcmd, channel factory init with explicit interface, on both Python 3.10 and 3.12).

Tested

  • Ubuntu 24.04, kernel 6.17, RTX 6000 Ada, Python 3.10 (.venv_sim)
  • Double-init snippet above passes after the patch
  • run_sim_loop.py --no-enable-onscreen --enable-offscreen boots past DDS init

…x cyclonedds pin

Two stacked failures on Ubuntu 24.04 (kernel 6.x):

1. cyclonedds 0.10.2's Domain creation hangs indefinitely on recent
   kernels, so run_sim_loop.py dies at ChannelFactoryInitialize with no
   error. Relax the pin to >=0.10.2,<12 (the SDK works unmodified
   against cyclonedds 11.x).

2. With cyclonedds >= 11, re-creating a Domain for the same id in one
   process raises DDSException ("Occurred upon initialisation of a
   cyclonedds.domain.Domain"). run_sim_loop.py initializes the channel
   factory from both the control loop and the simulator, so the second
   Init failed the whole loop:

       ChannelFactoryInitialize(0, 'lo')   # ok
       ChannelFactoryInitialize(0, 'lo')   # raises

   ChannelFactory is already a Singleton; make Init a no-op when the
   domain is live.
@PhysicistJohn

Copy link
Copy Markdown
Author

Note: upstream unitreerobotics/unitree_sdk2_python master already carries an equivalent idempotence guard in ChannelFactory.Init (an __initialized flag with a lock), so the guard here is effectively a backport to the vendored copy — syncing external_dependencies/unitree_sdk2_python with upstream would be an equally good resolution. The cyclonedds pin relax is also filed upstream as unitreerobotics/unitree_sdk2_python#161.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant