Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash after adding model and resetting #2624

Closed
gzfuzz opened this issue Sep 15, 2024 · 3 comments · Fixed by #2686
Closed

Crash after adding model and resetting #2624

gzfuzz opened this issue Sep 15, 2024 · 3 comments · Fixed by #2686
Labels
bug Something isn't working

Comments

@gzfuzz
Copy link

gzfuzz commented Sep 15, 2024

Environment

  • OS Version: Ubuntu 24.04
  • Source or binary build?
    source build
    gz-sim9 version: 3765579
    built with
    gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4)
    build options: -DCMAKE_BUILD_TYPE=Coverage
    also reproduced on gz-sim8 version: a167312

Description

  • Expected behavior: Gazebo doesn't crash
  • Actual behavior: Gazebo crashes

Steps to reproduce

  1. gz sim examples/worlds/detachable_joint.sdf -r &
  2. call /world/detachable_joint/create to add model extracted from the detachable_joint example
gz service --timeout 10000 -s /world/detachable_joint/create --reptype gz.msgs.Boolean --reqtype gz.msgs.EntityFactory --req 'sdf: "<sdf version=\"1.11\"><model name=\"vehicle_blue\">\n      <pose>0 2 0.325 0 -0 0</pose>\n      <self_collide>true</self_collide>\n\n      <link name=\"chassis\">\n        <pose>-0.151427 -0 0.175 0 -0 0</pose>\n        <inertial>\n          <mass>1.14395</mass>\n          <inertia>\n            <ixx>0.126164</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.416519</iyy>\n            <iyz>0</iyz>\n            <izz>0.481014</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <box>\n              <size>2.01142 1 0.568726</size>\n            </box>\n          </geometry>\n          <material>\n            <ambient>0.5 0.5 1.0 1</ambient>\n            <diffuse>0.5 0.5 1.0 1</diffuse>\n            <specular>0.0 0.0 1.0 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <box>\n              <size>2.01142 1 0.568726</size>\n            </box>\n          </geometry>\n        </collision>\n      </link>\n\n      <link name=\"front_left_wheel\">\n        <pose>0.554283 0.625029 -0.025 -1.5707 0 0</pose>\n        <inertial>\n          <mass>2</mass>\n          <inertia>\n            <ixx>0.145833</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.145833</iyy>\n            <iyz>0</iyz>\n            <izz>0.125</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <material>\n            <ambient>0.2 0.2 0.2 1</ambient>\n            <diffuse>0.2 0.2 0.2 1</diffuse>\n            <specular>0.2 0.2 0.2 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <surface>\n            <friction>\n              <ode>\n                <mu>1</mu>\n                <mu2>1</mu2>\n                <slip1>0.035</slip1>\n                <slip2>0</slip2>\n                <fdir1>0 0 1</fdir1>\n              </ode>\n              <bullet>\n                <friction>1</friction>\n                <friction2>1</friction2>\n                <rolling_friction>0.1</rolling_friction>\n              </bullet>\n            </friction>\n          </surface>\n        </collision>\n      </link>\n\n      <link name=\"rear_left_wheel\">\n        <pose>-0.957138 0.625029 -0.025 -1.5707 0 0</pose>\n        <inertial>\n          <mass>2</mass>\n          <inertia>\n            <ixx>0.145833</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.145833</iyy>\n            <iyz>0</iyz>\n            <izz>0.125</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <material>\n            <ambient>0.2 0.2 0.2 1</ambient>\n            <diffuse>0.2 0.2 0.2 1</diffuse>\n            <specular>0.2 0.2 0.2 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <surface>\n            <friction>\n              <ode>\n                <mu>1</mu>\n                <mu2>1</mu2>\n                <slip1>0.035</slip1>\n                <slip2>0</slip2>\n                <fdir1>0 0 1</fdir1>\n              </ode>\n              <bullet>\n                <friction>1</friction>\n                <friction2>1</friction2>\n                <rolling_friction>0.1</rolling_friction>\n              </bullet>\n            </friction>\n          </surface>\n        </collision>\n      </link>\n\n      <link name=\"front_right_wheel\">\n        <pose>0.554282 -0.625029 -0.025 -1.5707 0 0</pose>\n        <inertial>\n          <mass>2</mass>\n          <inertia>\n            <ixx>0.145833</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.145833</iyy>\n            <iyz>0</iyz>\n            <izz>0.125</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <material>\n            <ambient>0.2 0.2 0.2 1</ambient>\n            <diffuse>0.2 0.2 0.2 1</diffuse>\n            <specular>0.2 0.2 0.2 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <surface>\n            <friction>\n              <ode>\n                <mu>1</mu>\n                <mu2>1</mu2>\n                <slip1>0.035</slip1>\n                <slip2>0</slip2>\n                <fdir1>0 0 1</fdir1>\n              </ode>\n              <bullet>\n                <friction>1</friction>\n                <friction2>1</friction2>\n                <rolling_friction>0.1</rolling_friction>\n              </bullet>\n            </friction>\n          </surface>\n        </collision>\n      </link>\n\n      <link name=\"rear_right_wheel\">\n        <pose>-0.957138 -0.625029 -0.025 -1.5707 0 0</pose>\n        <inertial>\n          <mass>2</mass>\n          <inertia>\n            <ixx>0.145833</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.145833</iyy>\n            <iyz>0</iyz>\n            <izz>0.125</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <material>\n            <ambient>0.2 0.2 0.2 1</ambient>\n            <diffuse>0.2 0.2 0.2 1</diffuse>\n            <specular>0.2 0.2 0.2 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <surface>\n            <friction>\n              <ode>\n                <mu>1</mu>\n                <mu2>1</mu2>\n                <slip1>0.035</slip1>\n                <slip2>0</slip2>\n                <fdir1>0 0 1</fdir1>\n              </ode>\n              <bullet>\n                <friction>1</friction>\n                <friction2>1</friction2>\n                <rolling_friction>0.1</rolling_friction>\n              </bullet>\n            </friction>\n          </surface>\n        </collision>\n      </link>\n\n\n      <joint name=\"front_left_wheel_joint\" type=\"revolute\">\n        <parent>chassis</parent>\n        <child>front_left_wheel</child>\n        <axis>\n          <xyz>0 0 1</xyz>\n          <limit>\n            <lower>-1.79769e+308</lower>\n            <upper>1.79769e+308</upper>\n          </limit>\n        </axis>\n      </joint>\n\n      <joint name=\"front_right_wheel_joint\" type=\"revolute\">\n        <parent>chassis</parent>\n        <child>front_right_wheel</child>\n        <axis>\n          <xyz>0 0 1</xyz>\n          <limit>\n            <lower>-1.79769e+308</lower>\n            <upper>1.79769e+308</upper>\n          </limit>\n        </axis>\n      </joint>\n\n      <joint name=\"rear_left_wheel_joint\" type=\"revolute\">\n        <parent>chassis</parent>\n        <child>rear_left_wheel</child>\n        <axis>\n          <xyz>0 0 1</xyz>\n          <limit>\n            <lower>-1.79769e+308</lower>\n            <upper>1.79769e+308</upper>\n          </limit>\n        </axis>\n      </joint>\n\n      <joint name=\"rear_right_wheel_joint\" type=\"revolute\">\n        <parent>chassis</parent>\n        <child>rear_right_wheel</child>\n        <axis>\n          <xyz>0 0 1</xyz>\n          <limit>\n            <lower>-1.79769e+308</lower>\n            <upper>1.79769e+308</upper>\n          </limit>\n        </axis>\n      </joint>\n\n      <plugin filename=\"gz-sim-diff-drive-system\" name=\"gz::sim::systems::DiffDrive\">\n        <left_joint>front_left_wheel_joint</left_joint>\n        <left_joint>rear_left_wheel_joint</left_joint>\n        <right_joint>front_right_wheel_joint</right_joint>\n        <right_joint>rear_right_wheel_joint</right_joint>\n        <wheel_separation>1.25</wheel_separation>\n        <wheel_radius>0.3</wheel_radius>\n      </plugin>\n      <plugin filename=\"gz-sim-detachable-joint-system\" name=\"gz::sim::systems::DetachableJoint\">\n       <parent_link>chassis</parent_link>\n       <child_model>B1</child_model>\n       <child_link>body</child_link>\n       <detach_topic>/B1/detach</detach_topic>\n       <attach_topic>/B1/attach</attach_topic>\n       <output_topic>/B1/state</output_topic>\n      </plugin>\n      <plugin filename=\"gz-sim-detachable-joint-system\" name=\"gz::sim::systems::DetachableJoint\">\n       <parent_link>chassis</parent_link>\n       <child_model>B2</child_model>\n       <child_link>body</child_link>\n       <detach_topic>/B2/detach</detach_topic>\n       <attach_topic>/B2/attach</attach_topic>\n       <output_topic>/B2/state</output_topic>\n      </plugin>\n      <plugin filename=\"gz-sim-detachable-joint-system\" name=\"gz::sim::systems::DetachableJoint\">\n       <parent_link>chassis</parent_link>\n       <child_model>B3</child_model>\n       <child_link>body</child_link>\n       <detach_topic>/B3/detach</detach_topic>\n       <attach_topic>/B3/attach</attach_topic>\n       <output_topic>/B3/state</output_topic>\n      </plugin>\n    </model></sdf>"
pose {
  position {
    x: 8
    y: 5
    z: 2
  }
}
name: "model"
allow_renaming: true'
  1. add the same model, to a different position. Interestingly, for gz-sim8, this step is optional to reproduce the crash
gz service --timeout 10000 -s /world/detachable_joint/create --reptype gz.msgs.Boolean --reqtype gz.msgs.EntityFactory --req 'sdf: "<sdf version=\"1.11\"><model name=\"vehicle_blue\">\n      <pose>0 2 0.325 0 -0 0</pose>\n      <self_collide>true</self_collide>\n\n      <link name=\"chassis\">\n        <pose>-0.151427 -0 0.175 0 -0 0</pose>\n        <inertial>\n          <mass>1.14395</mass>\n          <inertia>\n            <ixx>0.126164</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.416519</iyy>\n            <iyz>0</iyz>\n            <izz>0.481014</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <box>\n              <size>2.01142 1 0.568726</size>\n            </box>\n          </geometry>\n          <material>\n            <ambient>0.5 0.5 1.0 1</ambient>\n            <diffuse>0.5 0.5 1.0 1</diffuse>\n            <specular>0.0 0.0 1.0 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <box>\n              <size>2.01142 1 0.568726</size>\n            </box>\n          </geometry>\n        </collision>\n      </link>\n\n      <link name=\"front_left_wheel\">\n        <pose>0.554283 0.625029 -0.025 -1.5707 0 0</pose>\n        <inertial>\n          <mass>2</mass>\n          <inertia>\n            <ixx>0.145833</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.145833</iyy>\n            <iyz>0</iyz>\n            <izz>0.125</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <material>\n            <ambient>0.2 0.2 0.2 1</ambient>\n            <diffuse>0.2 0.2 0.2 1</diffuse>\n            <specular>0.2 0.2 0.2 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <surface>\n            <friction>\n              <ode>\n                <mu>1</mu>\n                <mu2>1</mu2>\n                <slip1>0.035</slip1>\n                <slip2>0</slip2>\n                <fdir1>0 0 1</fdir1>\n              </ode>\n              <bullet>\n                <friction>1</friction>\n                <friction2>1</friction2>\n                <rolling_friction>0.1</rolling_friction>\n              </bullet>\n            </friction>\n          </surface>\n        </collision>\n      </link>\n\n      <link name=\"rear_left_wheel\">\n        <pose>-0.957138 0.625029 -0.025 -1.5707 0 0</pose>\n        <inertial>\n          <mass>2</mass>\n          <inertia>\n            <ixx>0.145833</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.145833</iyy>\n            <iyz>0</iyz>\n            <izz>0.125</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <material>\n            <ambient>0.2 0.2 0.2 1</ambient>\n            <diffuse>0.2 0.2 0.2 1</diffuse>\n            <specular>0.2 0.2 0.2 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <surface>\n            <friction>\n              <ode>\n                <mu>1</mu>\n                <mu2>1</mu2>\n                <slip1>0.035</slip1>\n                <slip2>0</slip2>\n                <fdir1>0 0 1</fdir1>\n              </ode>\n              <bullet>\n                <friction>1</friction>\n                <friction2>1</friction2>\n                <rolling_friction>0.1</rolling_friction>\n              </bullet>\n            </friction>\n          </surface>\n        </collision>\n      </link>\n\n      <link name=\"front_right_wheel\">\n        <pose>0.554282 -0.625029 -0.025 -1.5707 0 0</pose>\n        <inertial>\n          <mass>2</mass>\n          <inertia>\n            <ixx>0.145833</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.145833</iyy>\n            <iyz>0</iyz>\n            <izz>0.125</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <material>\n            <ambient>0.2 0.2 0.2 1</ambient>\n            <diffuse>0.2 0.2 0.2 1</diffuse>\n            <specular>0.2 0.2 0.2 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <surface>\n            <friction>\n              <ode>\n                <mu>1</mu>\n                <mu2>1</mu2>\n                <slip1>0.035</slip1>\n                <slip2>0</slip2>\n                <fdir1>0 0 1</fdir1>\n              </ode>\n              <bullet>\n                <friction>1</friction>\n                <friction2>1</friction2>\n                <rolling_friction>0.1</rolling_friction>\n              </bullet>\n            </friction>\n          </surface>\n        </collision>\n      </link>\n\n      <link name=\"rear_right_wheel\">\n        <pose>-0.957138 -0.625029 -0.025 -1.5707 0 0</pose>\n        <inertial>\n          <mass>2</mass>\n          <inertia>\n            <ixx>0.145833</ixx>\n            <ixy>0</ixy>\n            <ixz>0</ixz>\n            <iyy>0.145833</iyy>\n            <iyz>0</iyz>\n            <izz>0.125</izz>\n          </inertia>\n        </inertial>\n        <visual name=\"visual\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <material>\n            <ambient>0.2 0.2 0.2 1</ambient>\n            <diffuse>0.2 0.2 0.2 1</diffuse>\n            <specular>0.2 0.2 0.2 1</specular>\n          </material>\n        </visual>\n        <collision name=\"collision\">\n          <geometry>\n            <sphere>\n              <radius>0.3</radius>\n            </sphere>\n          </geometry>\n          <surface>\n            <friction>\n              <ode>\n                <mu>1</mu>\n                <mu2>1</mu2>\n                <slip1>0.035</slip1>\n                <slip2>0</slip2>\n                <fdir1>0 0 1</fdir1>\n              </ode>\n              <bullet>\n                <friction>1</friction>\n                <friction2>1</friction2>\n                <rolling_friction>0.1</rolling_friction>\n              </bullet>\n            </friction>\n          </surface>\n        </collision>\n      </link>\n\n\n      <joint name=\"front_left_wheel_joint\" type=\"revolute\">\n        <parent>chassis</parent>\n        <child>front_left_wheel</child>\n        <axis>\n          <xyz>0 0 1</xyz>\n          <limit>\n            <lower>-1.79769e+308</lower>\n            <upper>1.79769e+308</upper>\n          </limit>\n        </axis>\n      </joint>\n\n      <joint name=\"front_right_wheel_joint\" type=\"revolute\">\n        <parent>chassis</parent>\n        <child>front_right_wheel</child>\n        <axis>\n          <xyz>0 0 1</xyz>\n          <limit>\n            <lower>-1.79769e+308</lower>\n            <upper>1.79769e+308</upper>\n          </limit>\n        </axis>\n      </joint>\n\n      <joint name=\"rear_left_wheel_joint\" type=\"revolute\">\n        <parent>chassis</parent>\n        <child>rear_left_wheel</child>\n        <axis>\n          <xyz>0 0 1</xyz>\n          <limit>\n            <lower>-1.79769e+308</lower>\n            <upper>1.79769e+308</upper>\n          </limit>\n        </axis>\n      </joint>\n\n      <joint name=\"rear_right_wheel_joint\" type=\"revolute\">\n        <parent>chassis</parent>\n        <child>rear_right_wheel</child>\n        <axis>\n          <xyz>0 0 1</xyz>\n          <limit>\n            <lower>-1.79769e+308</lower>\n            <upper>1.79769e+308</upper>\n          </limit>\n        </axis>\n      </joint>\n\n      <plugin filename=\"gz-sim-diff-drive-system\" name=\"gz::sim::systems::DiffDrive\">\n        <left_joint>front_left_wheel_joint</left_joint>\n        <left_joint>rear_left_wheel_joint</left_joint>\n        <right_joint>front_right_wheel_joint</right_joint>\n        <right_joint>rear_right_wheel_joint</right_joint>\n        <wheel_separation>1.25</wheel_separation>\n        <wheel_radius>0.3</wheel_radius>\n      </plugin>\n      <plugin filename=\"gz-sim-detachable-joint-system\" name=\"gz::sim::systems::DetachableJoint\">\n       <parent_link>chassis</parent_link>\n       <child_model>B1</child_model>\n       <child_link>body</child_link>\n       <detach_topic>/B1/detach</detach_topic>\n       <attach_topic>/B1/attach</attach_topic>\n       <output_topic>/B1/state</output_topic>\n      </plugin>\n      <plugin filename=\"gz-sim-detachable-joint-system\" name=\"gz::sim::systems::DetachableJoint\">\n       <parent_link>chassis</parent_link>\n       <child_model>B2</child_model>\n       <child_link>body</child_link>\n       <detach_topic>/B2/detach</detach_topic>\n       <attach_topic>/B2/attach</attach_topic>\n       <output_topic>/B2/state</output_topic>\n      </plugin>\n      <plugin filename=\"gz-sim-detachable-joint-system\" name=\"gz::sim::systems::DetachableJoint\">\n       <parent_link>chassis</parent_link>\n       <child_model>B3</child_model>\n       <child_link>body</child_link>\n       <detach_topic>/B3/detach</detach_topic>\n       <attach_topic>/B3/attach</attach_topic>\n       <output_topic>/B3/state</output_topic>\n      </plugin>\n    </model></sdf>"
pose {
  position {
    x: 20
    y: 20
    z: 2
  }
}
name: "model"
allow_renaming: true'
  1. reset the world with the following command, or with the reset button from GUI
gz service --timeout 10000 -s /world/detachable_joint/control/state --reptype gz.msgs.Boolean --reqtype gz.msgs.WorldControlState --req 'world_control {
  reset {
    all: true
  }
}'

Also worked by extracting a.tar.gz, then run gz sim a.sdf -r&, and bash a.sh

Output

terminate called after throwing an instance of 'std::out_of_range'
  what():  unordered_map::at
Stack trace (most recent call last):
#31   Object "/data/play/robot/workspace/install/lib/libgz-sim9-gz.so.9.0.0~pre1", at 0x7310580bdc83, in runServer
#30   Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x7310569e1707, in gz::sim::v9::Server::Run(bool, unsigned long, bool)
#29   Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x731056a51bda, in 
#28   Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x731056a835f3, in gz::sim::v9::SimulationRunner::Run(unsigned long)
#27   Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x731056a845f8, in gz::sim::v9::SimulationRunner::Step(gz::sim::v9::UpdateInfo const&)
#26   Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x731056a80640, in gz::sim::v9::SimulationRunner::UpdateSystems()
#25   Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x731056af0c48, in gz::sim::v9::SystemManager::Reset(gz::sim::v9::UpdateInfo const&, gz::sim::v9::EntityComponentManager&)
#24   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ab283c5, in 
#23   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ab46cfa, in 
#22   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ab3961f, in 
#21   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102abfbab2, in void gz::sim::v9::EntityComponentManager::EachRemoved<gz::sim::v9::components::Component<gz::sim::v9::components::DetachableJointInfo, gz::sim::v9::components::DetachableJointTag, gz::sim::v9::serializers::DetachableJointInfoSerializer> >(gz::sim::v9::EntityComponentManager::identity<std::function<bool (unsigned long const&, gz::sim::v9::components::Component<gz::sim::v9::components::DetachableJointInfo, gz::sim::v9::components::DetachableJointTag, gz::sim::v9::serializers::DetachableJointInfoSerializer> const*)> >::type) const
#20   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ac413fe, in 
#19   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102acc2736, in 
#18   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ad1c734, in 
#17   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ab5c95e, in 
#16   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ab687d3, in 
#15   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ab7644b, in 
#14   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102ab39303, in 
#13   Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-physics-system.so", at 0x73102abfb963, in gz::physics::DetachJointFeature::Joint<gz::physics::FeaturePolicy<double, 3ul>, gz::sim::v9::systems::PhysicsPrivate::DetachableJointFeatureList>::Detach()
#12   Object "/data/play/robot/workspace/install/lib/gz-physics-8/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x73102551ce95, in 
#11   Object "/data/play/robot/workspace/install/lib/gz-physics-8/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x731025529fa5, in 
#10   Object "/data/play/robot/workspace/install/lib/gz-physics-8/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x731025462d94, in 
#9    Object "/data/play/robot/workspace/install/lib/gz-physics-8/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x731025462e7c, in 
#8    Object "/data/play/robot/workspace/install/lib/gz-physics-8/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x731025462f6b, in 
#7    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x731058ea93d7, in std::__throw_out_of_range(char const*)
#6    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x731058ebb127, in __cxa_throw
#5    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x731058ea5a48, in std::terminate()
#4    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x731058ebae9b, in 
#3    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x731058ea5ffd, in 
#2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x73105e4288fe, in abort
#1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x73105e44526d, in gsignal
#0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x73105e49eb1c, in pthread_kill
Aborted (Signal sent by tkill() 22573 1000)
@gzfuzz gzfuzz added the bug Something isn't working label Sep 15, 2024
@gzfuzz gzfuzz changed the title Crash after adding model with detachable_joint and resetting Crash after adding model and resetting Sep 15, 2024
@gzfuzz
Copy link
Author

gzfuzz commented Sep 16, 2024

Steps to reproduce could be simplified as:

  1. gz sim examples/worlds/detachable_joint.sdf
  2. remove the vehicle_blue model from GUI
  3. hit the reset button from GUI

@RPS98
Copy link

RPS98 commented Oct 1, 2024

I have experienced the same issue. I noticed the strange behavior that it works with two models inside the SDF being spawned, but not with three.

Environment

  • OS Version: Ubuntu 22.04
  • Binary: Gazebo Harmonic v8.6.0

Description

  • Expected behavior: Been able to reset Gazebo
  • Actual behavior: Gazebo crash

Steps to reproduce

Using the empty.sdf world:

  1. Open Gazebo using the empty.sdf world
gazebo empty.sdf
  1. Call the gazebo spawn service to spawn a model
gz service -s /world/empty/create --reqtype gz.msgs.EntityFactory --reptype gz.msgs.Boolean --timeout 1000 --req 'sdf_filename: "/home/rafa/test.sdf", name: "my_object"'

Using this test.sdf model:

<?xml version="1.0" ?>

<sdf version="1.6">
  <model name='box0'>
    <pose>0 0 0 0 0 0</pose>
    <link name="base_link">
      <visual name="visual">
        <geometry>
          <box>
            <size>0.2 0.2 0.2</size>
          </box>
        </geometry>
      </visual>
    </link>

    <model name="box1">
      <pose>0.3 0 0.5 0 0 0</pose>
      <link name="link1"></link>
    </model>

    <joint name="box1_joint" type="fixed">
      <parent>base_link</parent>
      <child>box1::link1</child>
    </joint>

    <model name="box2">
      <pose>0 -0.3 0.5 0 0 0</pose>
      <link name="link2"></link>
    </model>

    <joint name="box2_joint" type="fixed">
      <parent>base_link</parent>
      <child>box2::link2</child>
    </joint>

    <model name="box3">
      <pose>0 0 0.7 0 0 0</pose>
      <link name="link3"></link>
    </model>

    <joint name="box3_joint" type="fixed">
      <parent>base_link</parent>
      <child>box3::link3</child>
    </joint>
  </model>
</sdf>
  1. Call the gazebo reset service from the GUI and it will crash.

Important information

If the model is set inside the world file, it does not crash. Similarly, it doesn't crash if there are no more than two models.

The following SDF file does not crash, which is the same as the previous one but without the box3 model:

<?xml version="1.0" ?>

<sdf version="1.6">
  <model name='box0'>
    <pose>0 0 0 0 0 0</pose>
    <link name="base_link">
      <visual name="visual">
        <geometry>
          <box>
            <size>0.2 0.2 0.2</size>
          </box>
        </geometry>
      </visual>
    </link>

    <model name="box1">
      <pose>0.3 0 0.5 0 0 0</pose>
      <link name="link1"></link>
    </model>

    <joint name="box1_joint" type="fixed">
      <parent>base_link</parent>
      <child>box1::link1</child>
    </joint>

    <model name="box2">
      <pose>0 -0.3 0.5 0 0 0</pose>
      <link name="link2"></link>
    </model>

    <joint name="box2_joint" type="fixed">
      <parent>base_link</parent>
      <child>box2::link2</child>
    </joint>
  </model>
</sdf>

Output

terminate called after throwing an instanc` of 'std::out_of_range'
  what():  _Map_base::at
Stack trace (most recent call last):
#31   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7a52b217ba4e, in 
#30   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7a52b20a69ac, in rb_protect
#29   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7a52b223ec61, in rb_yield
#28   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7a52b223a30c, in rb_vm_exec
#27   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7a52b2234c96, in 
#26   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7a52b2231fc5, in 
#25   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7a52b222fc34, in 
#24   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x7a52b1ea544b, in 
#23   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7a52b21fd088, in rb_nogvl
#22   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x7a52b1ea4d6b, in 
#21   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x7a52b1e96492, in 
#20   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x7a52b1e99e2d, in 
#19   Object "/usr/lib/x86_64-linux-gnu/libgz-sim8-gz.so.8.6.0", at 0x7a52b1ab3605, in runServer
#18   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7a52ac53d485, in 
#17   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7a52ac54d8a2, in gz::sim::v8::SimulationRunner::Run(unsigned long)
#16   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7a52ac54ce60, in gz::sim::v8::SimulationRunner::Step(gz::sim::v8::UpdateInfo const&)
#15   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7a52ac55fb16, in gz::sim::v8::SystemManager::Reset(gz::sim::v8::UpdateInfo const&, gz::sim::v8::EntityComponentManager&)
#14   Object "/usr/lib/x86_64-linux-gnu/gz-sim-8/plugins/libgz-sim-physics-system.so", at 0x7a52a2f20e15, in gz::sim::v8::systems::PhysicsPrivate::ResetPhysics(gz::sim::v8::EntityComponentManager&)
#13   Object "/usr/lib/x86_64-linux-gnu/gz-sim-8/plugins/libgz-sim-physics-system.so", at 0x7a52a2f19ad6, in gz::sim::v8::systems::PhysicsPrivate::RemovePhysicsEntities(gz::sim::v8::EntityComponentManager const&)
#12   Object "/usr/lib/x86_64-linux-gnu/gz-sim-8/plugins/libgz-sim-physics-system.so", at 0x7a52a2f8958c, in 
#11   Object "/usr/lib/x86_64-linux-gnu/gz-physics-7/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x7a52761c76cf, in gz::physics::dartsim::EntityManagementFeatures::RemoveModel(gz::physics::Identity const&)
#10   Object "/usr/lib/x86_64-linux-gnu/gz-physics-7/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x7a52761cec23, in gz::physics::dartsim::Base::RemoveModelImpl(unsigned long, unsigned long)
#9    Object "/usr/lib/x86_64-linux-gnu/gz-physics-7/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x7a52761cebaf, in gz::physics::dartsim::Base::RemoveModelImpl(unsigned long, unsigned long)
#8    Object "/usr/lib/x86_64-linux-gnu/gz-physics-7/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x7a52761cc94b, in std::__detail::_Map_base<unsigned long, std::pair<unsigned long const, std::shared_ptr<gz::physics::dartsim::ModelInfo> >, std::allocator<std::pair<unsigned long const, std::shared_ptr<gz::physics::dartsim::ModelInfo> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true>, true>::at(unsigned long const&)
#7    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7a52ad6a549f, in std::__throw_out_of_range(char const*)
#6    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7a52ad6ae4d7, in __cxa_throw
#5    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7a52ad6ae276, in std::terminate()
#4    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7a52ad6ae20b, in 
#3    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7a52ad6a2b9d, in 
#2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7a52b1c287f2, in abort
#1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7a52b1c42475, in raise
#0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7a52b1c969fc, in pthread_kill
Aborted (Signal sent by tkill() 17407 1000)

@caguero
Copy link
Contributor

caguero commented Nov 18, 2024

According @iche033 , we need to implement some bookkeeping to undo the changes after combining the two models together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants