gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
728 stars 272 forks source link

Crash after calling control/state over model with OpticalTactilePlugin #2600

Open gzfuzz opened 2 months ago

gzfuzz commented 2 months ago

Environment

Description

Steps to reproduce

  1. gz sim gz-sim/examples/worlds/optical_tactile_sensor_plugin.sdf
  2. call /world/optical_tactile_plugin/control/state, with
gz service --timeout 10000 -s /world/optical_tactile_plugin/control/state --reptype gz.msgs.Boolean --reqtype gz.msgs.WorldControlState --req '
world_control {

  pause: true
  step: true
  multi_step: 833568079
  reset {
    all: true
    time_only: true
    model_only: true
  }
}'

Output

Stack trace (most recent call last):
#24   Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in 
#23   Object "gz sim a.sdf -r -v 0 -s --headless-rendering", at 0x563e055801c4, in _start
#22   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f617041ce3f, in __libc_start_main
#21   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f617041cd8f, in 
#20   Object "gz sim a.sdf -r -v 0 -s --headless-rendering", at 0x563e0558017e, in 
#19   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f61706c4e19, in ruby_run_node
#18   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f61706c1317, in 
#17   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f617085633c, in rb_vm_exec
#16   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f6170850cc6, in 
#15   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f617084dff5, in 
#14   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f617084bc64, in 
#13   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x7f616c3f944b, in 
#12   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f61708190b8, in rb_nogvl
#11   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x7f616c3f8d6b, in 
#10   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x7f616c3ea492, in 
#9    Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x7f616c3ede2d, in 
#8    Object "/data/play/robot/workspace/install/lib/libgz-sim8-gz.so.8.6.0", at 0x7f616b741d7d, in runServer
#7    Object "/home/ren/play/robot/workspace/install/lib/libgz-sim8.so.8", at 0x7f6169dbf692, in gz::sim::v8::Server::Run(bool, unsigned long, bool)
#6    Object "/home/ren/play/robot/workspace/install/lib/libgz-sim8.so.8", at 0x7f6169deb107, in 
#5    Object "/home/ren/play/robot/workspace/install/lib/libgz-sim8.so.8", at 0x7f6169e1bab4, in gz::sim::v8::SimulationRunner::Run(unsigned long)
#4    Object "/home/ren/play/robot/workspace/install/lib/libgz-sim8.so.8", at 0x7f6169e1c8d2, in gz::sim::v8::SimulationRunner::Step(gz::sim::v8::UpdateInfo const&)
#3    Object "/home/ren/play/robot/workspace/install/lib/libgz-sim8.so.8", at 0x7f6169e18aa8, in gz::sim::v8::SimulationRunner::UpdateSystems()
#2    Object "/data/play/robot/workspace/install/lib/gz-sim-8/plugins/libgz-sim-opticaltactileplugin-system.so", at 0x7f612aefbbe5, in gz::sim::v8::systems::OpticalTactilePlugin::PreUpdate(gz::sim::v8::UpdateInfo const&, gz::sim::v8::EntityComponentManager&)
#1    Object "/home/ren/play/robot/workspace/install/lib/libgz-msgs10.so.10", at 0x7f616595b3e0, in google::protobuf::RepeatedPtrField<gz::msgs::Contact>::begin() const
#0    Object "/home/ren/play/robot/workspace/install/lib/libgz-sim8.so.8", at 0x7f6169ed7c3c, in google::protobuf::internal::RepeatedPtrFieldBase::raw_data() const
Segmentation fault (Address not mapped to object [0x28])
gzfuzz commented 2 months ago

Also reproduced on gz-sim9 version: 518cc3184280670d13ac7ad806481334d28cbb87, with slightly different stack trace

Stack trace (most recent call last):
#31   Object "gz sim server", at 0x5f2285a981d4, in _start
#30   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x76530ae2a28a, in __libc_start_main
#29   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x76530ae2a1c9, in 
#28   Object "gz sim server", at 0x5f2285a98186, in 
#27   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b2b9192, in ruby_run_node
#26   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b2b4e5b, in 
#25   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b457b39, in rb_vm_exec
#24   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b4545db, in 
#23   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b4500fe, in 
#22   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b44d8ef, in 
#21   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b38e099, in 
#20   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b2b7216, in rb_protect
#19   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b45c2c9, in rb_yield
#18   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b457b39, in rb_vm_exec
#17   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b4545db, in 
#16   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b4500fe, in 
#15   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b44d8ef, in 
#14   Object "/usr/lib/x86_64-linux-gnu/ruby/3.2.0/fiddle.so", at 0x76530b027b13, in 
#13   Object "/lib/x86_64-linux-gnu/libruby-3.2.so.3.2", at 0x76530b4163bb, in rb_nogvl
#12   Object "/usr/lib/x86_64-linux-gnu/ruby/3.2.0/fiddle.so", at 0x76530b02743b, in 
#11   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x76530b0d80bd, in ffi_call
#10   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x76530b0d53ee, in 
#9    Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x76530b0d8b15, in 
#8    Object "/data/play/robot/workspace/install/lib/libgz-sim9-gz.so.9.0.0~pre1", at 0x765304abdc83, in runServer
#7    Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x7653033e1707, in gz::sim::v9::Server::Run(bool, unsigned long, bool)
#6    Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x765303451bda, in 
#5    Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x7653034835f3, in gz::sim::v9::SimulationRunner::Run(unsigned long)
#4    Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x7653034845f8, in gz::sim::v9::SimulationRunner::Step(gz::sim::v9::UpdateInfo const&)
#3    Object "/data/play/robot/workspace/install/lib/libgz-sim9.so.9", at 0x76530348082a, in gz::sim::v9::SimulationRunner::UpdateSystems()
#2    Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-opticaltactileplugin-system.so", at 0x7652ce10780b, in 
#1    Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-opticaltactileplugin-system.so", at 0x7652ce123b54, in 
#0    Object "/data/play/robot/workspace/install/lib/gz-sim-9/plugins/libgz-sim-opticaltactileplugin-system.so", at 0x7652ce10f3ac, in 
Segmentation fault (Address not mapped to object [0x28])