-
Notifications
You must be signed in to change notification settings - Fork 55
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
threads.ServiceThread hangs on exception #54
Comments
Also broken on: 3.8.0, using just the builtin examples, on master:
|
Also broken in python 3.6.9, but it exits fine in python 3.6.3. Aha! Going to trace that down to a single python version. |
3.6.6 passes. 3.6.7 is heisenbug. Sometimes ctrl-C exits cleanly. Sometimes not. This is true back to at least 3.6.3. |
Okay, having walked away in the middle of a test, here's what I've learned: there's two branch points for what looks like failure. An early ctrl-C will result in a hanging process, for exactly one minute. In general, in the example, if you let it run until it prints the
After that timeout, there's a second failure point, based around the threading changes in 3.7.4. In 3.7.4 and later with those changes, we hang as the interpreter is trying to exit:
and then hang what looks like indefinitely (multi-minute) until a second ctrl-C is thrown, at which point the exception in the threading module happens:
|
Debugging this is super confusing in part because mode's WorkerThread is overriding threading.Thread's _is_stopped attribute. This means if you look at the thread state in the repl/pdb, it will erroneously report the thread as stopped because |
Trying to get better debugging by running the example under |
After fixing the thread safety issues, it tentatively looks like the thread_loop isn't getting properly stopped and closed. When it isn't closed, the thread doesn't properly stop. The unstopped thread prevents interpreter exit. This doesn't fix @r313pp's crashing example (although it also not properly exits post-crash via ctrl-c!), but it does fix the tutorial so it properly exits on ctrl-c. It is causing test failures I haven't yet investigated. I'll try to hit both of those, probably next week, and get a branch and PR up.
|
@jbooth-mastery have you tried my PR #55? |
I'd missed your branch. It doesn't seem to work correctly for me:
I'm going to try to fix the tests I broke and then will look at merging your changes into my branch and will put it up as a PR. I'm hoping to get that all done today or tomorrow as this bug is a blocker for my team. |
I'll update the conflicts out of it and let's see how it looks? |
Checklist
master
branch of Mode.Steps to reproduce
Expected behavior
Process exits.
Actual behavior
Process hangs.
Full traceback
Versions
Additional Info
mode.threads.ServiceThread
andmode.threads.WorkerThread
locks each other when an exception is raised.I've dug up the problem, but I don't have sufficient knowledge of this lib to fix this properly.
Hire is what I've found (my comments are denoted by
###
):It also causes faust to hang as well:
Process will hang in crashed state.
Also, it seems to be causing this faust issue.
The text was updated successfully, but these errors were encountered: