Skip to content

ConsumeQueue decorator node returns incorrect status with async action node and empty queue #621

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

Closed
AnkitSaini opened this issue Jul 31, 2023 · 1 comment
Assignees

Comments

@AnkitSaini
Copy link

AnkitSaini commented Jul 31, 2023

Issue - We are seeing that the ConsumeQueue returns SUCCESS when it should return failure

Description - In case the ConsumeQueue decorator node is part of a tree that has Async action node the events where SUCCESS instead of FAILURE is returned can look like this -

  1. Inside while(!items.empty()) last item is popped
  2. child_node_ is ticked
  3. child_state is RUNNING hence RUNNING is returned from ConsumeQueue::tick()
  4. On next tick ConsumeQueue::tick() is called
  5. running_child_ was true from the previous tick
  6. State of child_node_ is checked and let's say it returns FAILURE
  7. haltChild() gets called and the logic continues on <---- THIS IS WHERE THE ISSUE IS
  8. while(!items.empty()) is not entered since queue is empty
  9. SUCCESS is returned at the bottom

A potential solution is to move reading the InputPort queue at the top. In case running_child_ is true followed by child_state_ is not RUNNING and queue->items.empty() is true, child_state_ should be returned after calling haltChild()

@facontidavide facontidavide self-assigned this Aug 1, 2023
facontidavide added a commit that referenced this issue Aug 14, 2023
@facontidavide
Copy link
Collaborator

ConsumeQueue is absolete and LoopNode should be preferred, but I am pushing a fix 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants