| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Both failures here are unrelated: test_iostream flake, eigen download problem. Trying again. |
Sorry, something went wrong.
…similar to pybind#4306, the only difference between the two PRs is the `"spawn"` vs `"forkserver"` argument).
|
Windows PyPy is still giving us DEADLOCK grief: https://github.com/pybind/pybind11/actions/runs/3379884767/jobs/5612023977 @mattip Do you have an interest and the tools for debugging these deadlocks? I think I've only ever seen this under Windows, but with with different PyPy versions (3.7, 3.8, 3.9). test_gil_scoped.py on master (or in the 2.10.1 release) is already set up for easy deadlock debugging, all you'd need to do is change these lines: -ALL_BASIC_TESTS_PLUS_INTENTIONAL_DEADLOCK = ALL_BASIC_TESTS + (_intentional_deadlock,)
+ALL_BASIC_TESTS_PLUS_INTENTIONAL_DEADLOCK = ALL_BASIC_TESTS # (_intentional_deadlock,)
-SKIP_IF_DEADLOCK = True # See PR #4216
+SKIP_IF_DEADLOCK = False # See PR #4216
...
- timeout = 0.1 if test_fn is _intentional_deadlock else 10
+ timeout = 0.1 if test_fn is _intentional_deadlock else 1000Then run test_gil_scoped.py and wait until it hits a deadlock, then attach a debugger to inspect the stack traces for the two threads waiting on the GIL. I don't have a suitable Windows machine and don't know anything about debugging under Windows. |
Sorry, something went wrong.
|
@Skylion007 Sorry I still need to put back the skipif for Windows PyPy, until we find someone who can help debugging the deadlocks for that platform. |
Sorry, something went wrong.
|
For completeness: There was another PyPy Windows deadlock under #4305, for PyPy 3.9 (the flake here was for 3.8): https://github.com/pybind/pybind11/actions/runs/3379830331/jobs/5611902870 For Windows there is no difference between that PR and this one. I'm not updating #4305 anymore. |
Sorry, something went wrong.
|
The CI passed now without any issues. I'm not expecting any deadlocks, except for PyPy Windows, which are now reported as such via pytest.skip(). After this PR is merged, deadlocks for other platforms will show up as CI failures, rather than getting skipped. I hope not seeing such CI failures will confirm over time that we're good. I don't know of another way to get that confirmation quicker. See #4105 (comment). |
Sorry, something went wrong.
|
@henryiii could you please help reviewing this tiny PR? I think it will take less than 5 minutes. I'm really keen to restore more rigorous testing after the 2.10.1 release went out. I wasn't completely comfortable effectively silencing the deadlock detection, it was mainly to support the 2.10.1 release. 2 days later I learned that multiprocessing "fork" is generally not safe in combination with threads, IOW we were using it wrong the whole time. The fix is super easy. Getting this merged soon means that we will easily see again when deadlocks are detected. I have high hopes that there will be none. Being sure about it will be very useful. |
Sorry, something went wrong.
|
@henryiii I'd appreciate if you could please comment on this PR. |
Sorry, something went wrong.
|
@eacousineau It would be great if you could help out here as well. It's a really tiny PR. As I wrote above, I'm still very keen to restore more rigorous testing after the 2.10.1 release went out. |
Sorry, something went wrong.
There was a problem hiding this comment.
Sounds good! First pass, PTAL!
Sorry, something went wrong.
| # Early diagnostic for failed imports | ||
| import pybind11_tests | ||
|
|
||
| if os.name != "nt": |
There was a problem hiding this comment.
nit Can you add a comment as to why we're doing this here?
git blame is decent for more context, but I think two small sentences can help explain, e.g.:
# We want to shy away from Python's default choice for Linux of "fork", as it can incur # post-fork resource contention issues (such as thread ids, etc.).
I'm vaguely familiar with this, and with our codebase we hit it with either sledgehammers of:
Sorry, something went wrong.
There was a problem hiding this comment.
Can you add a comment as to why we're doing this here?
Done. I tried to keep it concise.
Sorry, something went wrong.
There was a problem hiding this comment.
Hm... While this and the issue describes the symptoms, is there any way you can link to something that provides readers more context about the root cause of why threads + fork == bad / flaky?
(feel free to dismiss if you wanna add to issue discussion itself, or punt)
Sorry, something went wrong.
Alternative to PR pybind#4305
… will resolve the deadlocks for good.
There was a problem hiding this comment.
Thanks! Remaining comment, but feel free to dismiss / punt / what not.
Sorry, something went wrong.
| # Early diagnostic for failed imports | ||
| import pybind11_tests | ||
|
|
||
| if os.name != "nt": |
There was a problem hiding this comment.
Hm... While this and the issue describes the symptoms, is there any way you can link to something that provides readers more context about the root cause of why threads + fork == bad / flaky?
(feel free to dismiss if you wanna add to issue discussion itself, or punt)
Sorry, something went wrong.
TBH I was going only by the Python documentation (link in PR description: "Note that safely forking a multithreaded process is problematic.") and what @jbms told me. But I just found this: https://stackoverflow.com/questions/6078712/is-it-safe-to-fork-from-within-a-thread I'll add that to the PR description here. Thanks for the review! |
Sorry, something went wrong.
|
The one CI failure is a well-known PyPy flake: expected refcount mismatch. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
Please see #4105 (comment) for full background.
Alternative to PR #4305
Quoting from
https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods
fork
... Note that safely forking a multithreaded process is problematic.
Available on Unix only. The default on Unix.
The idea to try "spawn" or "forkserver"is the result of deadlock debugging. After reviewing tracebacks @jbms wrote:
This stackoverflow posting provides some details:
Excerpts:
Note that this PR only changes how test_gil_scoped.py is run, therefore a changelog entry is not needed.
Suggested changelog entry: