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
Raise exception if command timeout is triggered #43078
Conversation
The test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put these in a common method in case we want to change it later or add another handler. The handlers are still fine, but something like display_and_quit(msg)
would cut down on repetition
bin/ansible-connection
Outdated
% self.connection.get_option('persistent_connect_timeout'), log_only=True) | ||
msg = 'persistent connection idle timeout triggered, timeout value is %s secs' % self.connection.get_option('persistent_connect_timeout') | ||
display.display(msg, log_only=True) | ||
raise Exception(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, ansibot is right, you can't raise an exception here and still call shudown. If you really want the exception raised, you'd have to do it after shutdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's right I missed it completely. Though the issue here is after shutdown there is no active socket over which message can be sen to module side. Looking at alternate ways to implement this functionality.
Fixes ansible#43076 If persistent connection timeout is triggered, riase exception which will be send over socket to module code instead of silently shutting down the socket.
9fae997
to
6e405e7
Compare
ready_for_review |
@samccann As per our offline discussion added more context to error message. New message looks as below
|
bin/ansible-connection
Outdated
|
||
def handler(self, signum, frame): | ||
display.display('signal handler called with signal %s' % signum, log_only=True) | ||
self.shutdown() | ||
msg = 'signal handler called with signal %s.\nFor more details refer %s' % (signum, TIMEOUT_TROUBLESHOOT_URL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The url discussion aside, I really don't think we need it here- this is not a timeout, it's SIGTERM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
@samccann Any thoughts on what should be the error message. As mentioned in the troubleshooting doc there are 3 different ways to increase the timeout value and I am not sure how to fit it in a single error message. |
@ganeshrn How about. "See command_timeout, timeout, or ansible_command_timeout options to resolve this issue." At least that way, the customer has a string to look up on docs.ansible.com to find the information. And leaves us the flexibility to restructure content in the future w/o ending up with broken URL links in error messages. |
@samccann
Mentioning all the 3 options in error message might be confusing to users |
Okay then perhaps "See the timeout setting options in the Network Debug and Troubleshooting Guide." |
ready_for_review |
SUMMARY
Fixes #43076
If persistent connection timeout is triggered, riase
exception which will be send over socket to module code
instead of silently shutting down the socket.
ISSUE TYPE
COMPONENT NAME
bin/ansible-connection
ANSIBLE VERSION
ADDITIONAL INFORMATION
Before:
After: