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

SimpleActionState.execute will block when "ctrl+c" pressed #43

Open
developer-yj opened this issue Sep 20, 2016 · 3 comments
Open

SimpleActionState.execute will block when "ctrl+c" pressed #43

developer-yj opened this issue Sep 20, 2016 · 3 comments

Comments

@developer-yj
Copy link

developer-yj commented Sep 20, 2016

1, if "ctrl+c" pressed, "done_cb" will never be called by SimpleActionClient because rospy was shutdown, action client cannot receive action server's state message. So, it will be blocked by the code:"self._done_cond.wait()".

2, in multi-thread mode, run "SimpleActionState.execute()" in child thread, after "ctrl+c" pressed, call "SimpleActionState.request_preempt()" in main thread is not working because that, rospy was shutdown, call SimpleActionClient.cancel_goal() will be failed, So, it will be blocked by the code:"self._done_cond.wait()" again.

Suggestion:
check rospy's state in SimpleAction.request_preempt() function, if rospy is shutdown, call self._done_cond.notify() to notify SimpleAction.execute() function to return "preempted" state.

@sjhansen3
Copy link

I just rewrote the class without threading and it no longer blocks a signal.sigint. It seems the issue is related to signals behavior pre python 3.3

https://stackoverflow.com/questions/25676835/signal-handling-in-multi-threaded-python

@sjhansen3
Copy link

Is there interest for a PR on this?

@sjhansen3
Copy link

I spoke more about my issue and solution here: #52

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