actionlib icon indicating copy to clipboard operation
actionlib copied to clipboard

Race condition: Goal state is SUCCEEDED before result is available.

Open jorgenfb opened this issue 7 years ago • 4 comments

SimpleActionClient seems to have a race condition. Calling get_state() can give the SUCCEEDED state before a result is available.

This is a package showing the problem. It uses a SimpleActionClient to make a request and then checks client.get_state() at a high frequency to check for SUCCEEDED state and then checks if client.get_result() returns a result. An error is printed if the result is missing. It makes a maximum of 1000 requests to try to trigger this error. Run roslaunch action_client_breaker action_client_breaker.test and wait for a ERROR message in the console. action_client_breaker.zip

BufferClient in tf2_ros was previously affected by this issue. See ros/geometry2#178.

jorgenfb avatar Oct 27 '18 19:10 jorgenfb

Hi @jorgenfb

I also faced this issue when i am calling client.get_state() at around 5Hz. Have you find a solution / workaround for this?

Best, Samuel

HappySamuel avatar Oct 27 '21 07:10 HappySamuel

Yes, have a look at https://github.com/ros/geometry2/issues/178. Especially this comment: https://github.com/ros/geometry2/issues/178#issuecomment-431801344. You might be able to use:

your_simple_action_client.wait_for_result()

jorgenfb avatar Oct 27 '21 07:10 jorgenfb

Isn't the client.wait_for_result() will put whole system on wait? until result come out?

HappySamuel avatar Oct 27 '21 08:10 HappySamuel

Just your current thread. If you are only spinning until a result is ready, then you can use wait_for_result without any issue Regards Jørgen Borgesen nLink +47 456 19 649

The content of this e-mail is of a confidential and proprietary nature and may be protected by law. The content is only intended for the individual(s) named in the message. If you have received this e-mail by mistake, please reply to this message and delete the e-mail and its content afterwards. You may not copy or distribute any of the content in this e-mail.

On Wed, Oct 27, 2021 at 10:13 AM HappySamuel @.***> wrote:

Isn't the client.wait_for_result() will put whole system on wait? until result come out?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ros/actionlib/issues/116#issuecomment-952651358, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHQGM7BU2CBUTREKYVNCPDUI6YBFANCNFSM4F7WMEDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jorgenfb avatar Oct 27 '21 08:10 jorgenfb