-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix functhread daemon status and tmp_thread cleanup #10404
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
Conversation
dominikschubert
left a comment
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.
LGTM, looks safe to me. Appreciate the new logging, just added minor nits/suggestions to make the wording a bit clearer
| LOG.warning( | ||
| "[shutdown] Non-daemon thread %s may block localstack shutdown", thread | ||
| ) |
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.
👍 love the warning
| thread.stop(quiet=quiet) | ||
| except Exception as e: | ||
| print(e) | ||
| LOG.debug("[shutdown] Error stopping thread %s: %s", thread, e) |
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.
might the stack trace be interesting for us as well? 🤔
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.
given we only had a print statement so far, lets see how far we get :D
| ) | ||
| else: | ||
| threading.Thread.__init__(self) | ||
| threading.Thread.__init__(self, daemon=daemon) |
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.
Nice catch, definitely clearer that way.
Not sure if that actually caused issues though since using the setter is also part of the official API. Only difference in behavior should be the inheritance of the daemon state when passing None.
Co-authored-by: Dominik Schubert <dominik.schubert91@gmail.com>
Motivation
I noticed log lines in the builds during shutdown
After some digging, I found that our new stepfunctions provider is putting plain python threads into
TMP_THREADSthat don't have astopattribute. This PR doesn't fix this problem, but it improves error logging during shutdown for these types of issues.While doing that, I noticed that those stepfunction threads aren't daemon threads, and may potentially be blocking the shutdown, so I added specific logging for that as well.
I also noticed that
FuncThreadsetsself.daemon = True, but it's never passed to the constructor which does some additional setup to create a daemonic thread.Changes
FuncThreadinstances are now properly instantiated as daemon threads