-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Gracefully shutdown worker threads #47279
Conversation
2327859
to
b0f3627
Compare
Since close can be called more than once handle and log exceptions
salt/transport/tcp.py
Outdated
try: | ||
self.req_server.stop() | ||
except Exception as exc: | ||
log.debug("TCPReqServerChannel close generated an exception: %s" str(exc)) |
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.
This has a syntax error: there is a missing comma after %s"
.
re-run py |
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'll approve this but with a comment that can be handled in a follow-up PR.
try: | ||
self.req_server.stop() | ||
except Exception as exc: | ||
log.debug("TCPReqServerChannel close generated an exception: %s", str(exc)) |
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 think log.exception
would be better here.
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 think I can get rid of that completely by checking is_alive in the stop
method. If not, I'll change this to log exception.
What does this PR do?
Gracefully shutdown worker threads when TCPReqServerChannel is closed or destroyed.
Previous Behavior
Running thread causes processes not to terminate.
New Behavior
Threads will stop gracefully and processes will terminate as they should. This fixes the windows python 3 Jenkins build.
Tests written?
No - Fixes test suite
Commits signed with GPG?
No