Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Nov 3, 2025

🦟 Bug fix

Fixes #3158

Summary

This fixes a bug which prevents the simulation server running in multiple processes as described in https://gazebosim.org/api/sim/10/distributedsimulation.html.

The issue is described in #3158, essentially the NetworkManagerSecondary does not have the parent model associated with the performer entity.

There is also another issue where a dereference of a parent component to obtain the parent entity causes a segmentation fault when running more than one secondary. A check is added to prevent that.

There are some other issues with the distributed simulation as well, such as the pause button not having any effect, but that and other issues will not be dealt with in this PR as they do not prevent the example from running.

Details

The example used is levels.sdf. It is run in distributed mode on two secondaries as follows.

Terminal 1: secondary 1

gz sim -v4 -s -r --levels --network-role secondary levels.sdf

Terminal 2: secondary 2

gz sim -v4 -s -r --levels --network-role secondary levels.sdf

Terminal 3: primary

gz sim -v4 -s -r --levels --network-role primary --network-secondaries 2 levels.sdf

Terminal 4: gui

gz sim -v4 -g

Before this patch the errors reported in the associated issue occur. After this no errors are reported.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.


This is an automatic backport of pull request #3160 done by Mergify.

Fixes #3158

## Summary
This fixes a bug which prevents the simulation server running in multiple processes as described in https://gazebosim.org/api/sim/10/distributedsimulation.html.

The issue is described in #3158, essentially the NetworkManagerSecondary does not have the parent model associated with the performer entity.

There is also another issue where a dereference of a parent component to obtain the parent entity causes a segmentation fault when running more than one secondary. A check is added to prevent that.

There are some other issues with the distributed simulation as well, such as the pause button not having any effect, but that and other issues will not be dealt with in this PR as they do not prevent the example from running.

## Details
The example used is levels.sdf. It is run in distributed mode on two secondaries as follows.

Terminal 1: secondary 1

```
gz sim -v4 -s -r --levels --network-role secondary levels.sdf
```

Terminal 2: secondary 2
```
gz sim -v4 -s -r --levels --network-role secondary levels.sdf
```

Terminal 3: primary
```
gz sim -v4 -s -r --levels --network-role primary --network-secondaries 2 levels.sdf
```
Terminal 4: gui
```
gz sim -v4 -g
```
Before this patch the errors reported in the associated issue occur. After this no errors are reported.

Signed-off-by: Rhys Mainwaring <[email protected]>
Co-authored-by: Arjo Chakravarty <[email protected]>
(cherry picked from commit 4f48629)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎵 harmonic Gazebo Harmonic

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

2 participants