o3de / ROSConDemo

A robotic fruit picking demo project for O3DE with ROS 2 Gem
Other
70 stars 23 forks source link

Assigning new 2D Goal Pose to the Kraken while it is apple_gathering causes the Editor to crash when it finishes #203

Closed LB-ArturZieba closed 1 year ago

LB-ArturZieba commented 1 year ago

Describe the bug If the Kraken has movement queued in RViz while it is apple_gathering, the Editor will crash. Please note that this can be inconsistent, but provided steps were the most consistent in getting this issue. The following assert was found in Editor.log files of machines where this issue was reproduced:

Assert information: File:

/data/workspace/o3de/Code/Framework/AzCore/./AzCore/std/containers/unordered_map.h

Condition:

(139916683091136) 'const AZStd::unordered_map::mapped_type &AZStd::unordered_map<AZStd::pair<AppleKraken::EffectorState, AppleKraken::EffectorState>, AZStd::function<void ()>, AppleKraken::TransitionHash>::at(const AZStd::unordered_map::key_type &) const [Key = AZStd::pair<AppleKraken::EffectorState, AppleKraken::EffectorState>, MappedType = AZStd::function<void ()>, Hasher = AppleKraken::TransitionHash, EqualKey = AZStd::equal_to<AZStd::pair<AppleKraken::EffectorState, AppleKraken::EffectorState>>, Allocator = AZStd::allocator]'
Element with key is not present

Line: 225

Note that project was setup by following instruction - https://github.com/o3de/ROSConDemo/tree/main/docker.

For more information, please refer to the Video & logs section.

Prerequisites

Steps to reproduce

  1. Move the Kraken using 2D Goal Pose in RViz near a tree.
  2. Execute the apple_gather command.
  3. While the Kraken is apple_gathering, in RViz set another path using 2D Goal Pose.
  4. Wait for the apple_gather to finish.

Expected behavior Editor remains stable.

Actual behavior Editor crashes.

Video & logs

https://user-images.githubusercontent.com/86952082/206434847-b97f0c79-4927-4755-9782-22314484f030.mp4

GPC-602Editor.log GPC-610Editor.log

Found in Branch ROSConDemo: main (eb54128) O3DE: Development (5c57fee)

Desktop

LB-ArturZieba commented 1 year ago

Updated the Found in Branch with O3DE commit at the time of reporting: ROSConDemo: main (eb54128) O3DE: Development (5c57fee)

michalpelka commented 1 year ago

I belive that is fixed in the development branch, it is missing the state transition that we added. I cannot recreate it with the development branch.

lemonade-dm commented 1 year ago

It looks like the code is using unordered_map::at to return a reference to AZStd::function stored within the m_allowedTransactionMap.

It would be safer to either use the unordered_map::operator[], which would add an empty function entry to the map, which will avoid the crash.

michalpelka commented 1 year ago

This issue was already fixed here : https://github.com/o3de/ROSConDemo/commit/2b46c23366fade2c313b80cbdec36189ae849ea4 with this PR #169. It is not present in development branch.