Skip to content

Conversation

@srmainwaring
Copy link
Contributor

@srmainwaring srmainwaring commented Oct 28, 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.

- Create entities in secondary if requested in SimulationRunner::Step.
- Add check that parent component is valid before dereference.

Signed-off-by: Rhys Mainwaring <[email protected]>
@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Nov 3, 2025
@arjo129 arjo129 merged commit 4f48629 into gazebosim:gz-sim10 Nov 3, 2025
14 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Core development Nov 3, 2025
@arjo129
Copy link
Contributor

arjo129 commented Nov 3, 2025

@Mergifyio backport main gz-sim9 gz-sim8 ign-gazebo6

@mergify
Copy link
Contributor

mergify bot commented Nov 3, 2025

backport main gz-sim9 gz-sim8 ign-gazebo6

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Nov 3, 2025
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)
mergify bot pushed a commit that referenced this pull request Nov 3, 2025
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)
mergify bot pushed a commit that referenced this pull request Nov 3, 2025
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)
mergify bot pushed a commit that referenced this pull request Nov 3, 2025
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)
iche033 pushed a commit that referenced this pull request Nov 11, 2025
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]>
IceShuttle pushed a commit to IceShuttle/gz-sim that referenced this pull request Nov 14, 2025
)

Fixes gazebosim#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 gazebosim#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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪵 jetty Gazebo Jetty

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Secondary in distributed simulation fails to resolve performer parent

2 participants