Skip to content

Crash after adding plugin DiffDrive to non-existing entity in world contain plugin LogVideoRecorder #2867

@liyitao-code

Description

@liyitao-code

Environment

  • OS Version: Ubuntu 24.04
  • Source or binary build?
    Source build, use gz-sim9 version:d83d135
    Built with gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04)
    Build options: -DCMAKE_BUILD_TYPE=Coverage

Description

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

Steps to reproduce

  1. gz sim a.txt -r
  2. Add the plugin 'gz::sim::systems::DiffDrive' to a non-existent ID, or not writing the ID attribute can trigger this crash
gz service --timeout 500 -s /world/default/entity/system/add --reptype gz.msgs.Boolean --reqtype gz.msgs.EntityPlugin_V --req 'entity {
  id: 0
}
plugins {
  name: "gz::sim::systems::DiffDrive"
  filename: "gz-sim-diff-drive-system"
  innerxml: "<left_joint>front_left_wheel_joint</left_joint>\n<left_joint>w6ftNiUF9akRl6wcahvzf</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<topic>cmd_vel</topic>"
}
'

This crashing output is similar to #2512, but the use case for #2512 cannot trigger crashes in the sim9 version I am using. To trigger this crash, we need to add the plugin 'gz::sim::systems::LogVideoRecorder' in the world first.

Output

(2025-04-18 16:24:49.559) [error] [LogPlayback.cc:212] Unspecified log path to playback. Nothing to play.
(2025-04-18 16:25:01.609) [error] [DiffDrive.cc:185] DiffDrive plugin should be attached to a model entity. Failed to initialize.
Stack trace (most recent call last) in thread 272464:
#16   Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in 
#15   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7bfe29929c3b, in 
#14   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7bfe2989caa3, in 
#13   Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7bfe248ecdb3, in 
#12   Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-sim9.so.9", at 0x7bfe227ce985, in 
#11   Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-sim9.so.9", at 0x7bfe227ce9c5, in 
#10   Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-sim9.so.9", at 0x7bfe227cea39, in 
#9    Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-sim9.so.9", at 0x7bfe227ceb11, in 
#8    Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-sim9.so.9", at 0x7bfe227cebaf, in 
#7    Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-sim9.so.9", at 0x7bfe227bec6d, in 
#6    Object "/home/liyitao/workspace/gz_lastest/install/lib/gz-sim-9/plugins/libgz-sim-diff-drive-system.so", at 0x7bfde02ffb24, in 
#5    Object "/home/liyitao/workspace/gz_lastest/install/lib/gz-sim-9/plugins/libgz-sim-diff-drive-system.so", at 0x7bfde0301737, in 
#4    Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-math8.so.8", at 0x7bfe1dded3a3, in gz::math::v8::SpeedLimiter::Limit(double&, double, double, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) const
#3    Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-math8.so.8", at 0x7bfe1dded86a, in gz::math::v8::SpeedLimiter::LimitJerk(double&, double, double, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) const
#2    Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-math8.so.8", at 0x7bfe1ddedde1, in 
#1    Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-math8.so.8", at 0x7bfe1ddee0cd, in std::unique_ptr<gz::math::v8::SpeedLimiter::Implementation, void (*)(gz::math::v8::SpeedLimiter::Implementation*)>::get() const
#0    Object "/home/liyitao/workspace/gz_lastest/install/lib/libgz-math8.so.8", at 0x7bfe1ddee25c, in std::__uniq_ptr_impl<gz::math::v8::SpeedLimiter::Implementation, void (*)(gz::math::v8::SpeedLimiter::Implementation*)>::_M_ptr() const
Segmentation fault (Address not mapped to object [0x8])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions