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

Race bug in Actionlib Client where Result from Server can be missed #66

Closed
pbeeson opened this issue Feb 9, 2017 · 1 comment
Closed

Comments

@pbeeson
Copy link
Contributor

pbeeson commented Feb 9, 2017

There is a bug in the Actionlib client Goal Manager, where the result from the server can be missed, causing the client application's call to waitForResult() to fail.

A simple patch, which just moves an if-block a few lines away, has been provided in PR #64

I've opened this issue as a way to discuss this or future similar issues, and to provide a way to deterministically reproduce the bug using any Actionlib client/server pair where the server finishes and calls setSucceeded() in under 5 seconds from receiving the goal.

To reproduce, simply add the following debug spew and sleep lines to the current indigo-devel goal_manager_imp.h, re-compile the testing actionlib client, and run the server and client. The waitForResult() call in the test client will either hang indefinitely is a 0 timeout is used, or timeout without a result if >0 timeout is used.

diff --git a/include/actionlib/client/goal_manager_imp.h b/include/actionlib/client/goal_manager_imp.h
index 4df1229..709e4a8 100644
--- a/include/actionlib/client/goal_manager_imp.h
+++ b/include/actionlib/client/goal_manager_imp.h
@@ -70,6 +70,10 @@ ClientGoalHandle<ActionSpec> GoalManager<ActionSpec>::initGoal(const Goal& goal,
   typedef CommStateMachine<ActionSpec> CommStateMachineT;
   boost::shared_ptr<CommStateMachineT> comm_state_machine(new CommStateMachineT(action_goal, transition_cb, feedback_cb));
 
+  ROS_WARN("Actionlib Client has sent goal to server.  It will now sleep for 5 seconds in order to uncover bug.");
+  ros::Duration(5.0).sleep();
+  ROS_WARN("Done Sleeping.  If Actionlib server already finished and returned result, then the Result will now be missed, and the Client will fail on waitForResult()");
+
   boost::recursive_mutex::scoped_lock lock(list_mutex_);
   typename ManagedListT::Handle list_handle = list_.add(comm_state_machine, boost::bind(&GoalManagerT::listElemDeleter, this, _1), guard_);
@pbeeson pbeeson mentioned this issue Feb 9, 2017
@mikaelarguedas
Copy link
Member

Fixed by #64

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