actionlib icon indicating copy to clipboard operation
actionlib copied to clipboard

Avoid waiting in loops

Open mgrrx opened this issue 4 years ago • 4 comments

Using strace we recently figured out that Python nodes are waking up quite frequently and usually this is done for, let's say, no reason.

In the action server implementation here we basically just want to ensure that the executeLoop does not block if we terminate the executable. I rewrote that part by using a condition object and the shutdown hooks.

At the same time I removed the terminate_mutex since it's not needed - at least I couldn't see any reason for it.

Waiting for 100ms actually does not mean that your program is sleeping for 100ms (https://github.com/python/cpython/blob/2.7/Lib/threading.py#L350).

mgrrx avatar Mar 27 '20 16:03 mgrrx

@mgrrx

could you check the CI failure? http://build.ros.org/job/Npr__actionlib__ubuntu_focal_amd64/34/testReport/rostest.runner/RosTest/testtest_cpp_simple_client/

fujitatomoya avatar Mar 28 '20 03:03 fujitatomoya

rostest.runner.RosTest.testtest_cpp_simple_client has been in some problems in CI, I am not sure what goes wrong but it just does not get succeeded. (sometimes raise exeception, sometimes timeout so the state is still in active state.)

fujitatomoya avatar Mar 28 '20 03:03 fujitatomoya

I assume it's unrelated since there are similar failures every now and then

mgrrx avatar Mar 30 '20 18:03 mgrrx

Regarding the test I guess it's the same as in https://github.com/ros/actionlib/pull/156#issuecomment-595713514.

jschleicher avatar Mar 31 '20 10:03 jschleicher