GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — Pin Python 3.9.16 on Cygwin CI by EliahKagan · Pull Request #1814 · gitpython-developers/GitPython Conversation
|
|
Thanks a lot for the investigation, and for coming up with a fix after what seems like arduous work with more than 40 attempts. What surprises me the most is that I didn't see a link to an official tracking issue for this bug in what might the c-python repository - after all, a lot of people should have encountered it (but apparently didn't). Definitely still puzzling. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think the bug is probably in the downstream Cygwin package for Python 3.9.18, or in some other component of Cygwin but only triggered due to changes in 3.9.18. But I haven't found anything about it on the Cygwin mailing lists. I might investigate it further. Now that I can produce it locally, I could try to come up with a minimal way to produce it, then observe that with Cygwin's |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
That's great to hear! I have a feeling that this bug is great for denial of service attacks against toolchains given that it spins hot forever and ignores all non-fatal signals as well. If you can track it down that might be preventing further damage to the wider internet - part of me probably can't believe that GitPython is so special it's the only project experiencing the issue. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
It turns out that the more specific trigger in Contrary to what my experiments described above had led me to think, this does actually depend to some extent on the version of pip that is used. If an old enough version is used, it draws progress bars in a different way that is not affected. In the past, pip vendored progress and used it to draw progress bars; that vendored dependency was removed in pip 22.1. Recent versions of pip use a feature of their vendored rich dependency to draw progress bars. Because a version of pip with a differently implemented progress bar doesn't stall, I suspect the problem may really be triggered by the progress bar drawing code. However, the bug still appears to be in Python 3.9.18 as packaged for Cygwin, and not in rich or pip, unless the other indefinite stalling problem, detailed below, that happens after this one is overcome, turns out, somehow, to be altogether separate. DetailsI experimented with turning off the progress bars is in 6f57fe5. In that commit's Cygwin run, it gets past I have not managed to produce that locally because I get a different effect. Locally, the malfunction is at the same point, on the way into the decorator wrapper for This happens when the decorator wrapper sets up a remote repository. Surprisingly, the problem seems unrelated to the wrapper's use of python -c 'import time, git; print(git.Repo().remote().fetch()); time.sleep(0.12); print("OK.")'
When I produce the problem interactively in a REPL or The problem might be triggered by something in It appears NumPy's CI is also affectedMy earlier web searches had not turned up other projects that had a similar problem to what this PR works around. But more recently, a search revealed numpy/numpy#25708, which seems to be the same problem, in which Python stalls on Cygwin since the upgrade from the downstream 3.9.16 to the downstream 3.9.18. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks so much for sharing this early result, a very interesting read! Can While reading, I thought "threads, pipes, subprocess spawning, lots of syscalls, forks, locks" as things that probably happen concurrently here. And the fact that it's not the whole world suffering from this probably means is something rather specific at the intersection of numpy and GitPython (and who knows which else). The silent exit 0 the could be produced locally makes me think that it can't be the work of a signal, but would be typical for what happens once a forked process exits successfully. It's like the memory of the parent of the fork gets messed with, causing it to exit instead. This shouldn't be possible with a normal Anyway, that's all I've got 😁. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This has been found to affect Pillow's CI (as well as GitPython's and NumPy's): It has also been reported to the Cygwin mailing list (Cygwin does not use a separate bug tracker):
Yes, Daniel Abrahamsson found that When I ran the strangely terminating case described above with GitPython's It looks like terminating may be a rare manifestation of the bug, and that looping forever is much more common. When I simplified the import hashlib import threading import time t1 = threading.Thread(target=lambda: print("hello")) t2 = threading.Thread(target=lambda: print("goodbye")) t1.start() time.sleep(1) print("in between") t2.start() t1.join() t2.join() Key point: While Other observations:
Although I got to that by starting with experiments in GitPython, that script produces the problem outside a virtual environment (i.e., in a global environment where GitPython is not installed). I ran it from a Cygwin bash shell with: /usr/bin/python3.9 simple.py And, for strace -o strace.out /usr/bin/python3.9 simple.py By the time I killed the process in the I made a copy of the first 6610 lines of the file in I expect some of this information may be useful to the Cygwin Python package maintainer and possibly other users/developers, and I will try to post to the Cygwin mailing list soon. In case it turns out to be useful in subsequent experimentation on GitPython, the relationship between the short script shown above and code in GitPython that runs in a These child threads may sometimes correspond to I tested with a shell script that outputs both to stdout and stderr, initially with #!/bin/bash for i in {9..0}; do sleep 0.1 if ((i % 2 == 0)); then printf '%d\n' "$i" else printf '%d\n' "$i" >&2 fi done For test and demonstration purposes, #!/usr/bin/env python from subprocess import PIPE, Popen import threading import git def handle_process_output(process, stdout_handler, stderr_handler): def pump_stream(stream, handler): try: for line in stream: handler(line) finally: stream.close() pumps = [ (process.stdout, stdout_handler), (process.stderr, stderr_handler), ] threads = [] for stream, handler in pumps: t = threading.Thread(target=pump_stream, args=(stream, handler)) t.start() threads.append(t) for t in threads: t.join() def run_job(): proc = Popen(["bash", "countdown"], stdout=PIPE, stderr=PIPE) handle_process_output( proc, lambda line: print(f"stdout: {line!r}"), lambda line: print(f"stderr: {line!r}"), ) proc.wait() def main(): for i in range(1, 11): print(f"Job {i}:") run_job() print("Done.") if __name__ == "__main__": main() Notice that the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This is downright amazing, and I am impressed by your ability to minimise the reproducer testcase! With it, it should be easy to find the culprit and fix it. And excuse my ignorance here, but is it correct that the reproducer script will only trigger on particular versions of Python? Or only when running in a Cygwin environment? I am asking because with it it should be possible to bisect the corresponding interpreter source-code to the exact breaking commit. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
The problem strongly appears specific to the intersection of Python 3.9.18 and Cygwin, and the script behaves accordingly. This is to say that I found that script only to hang on that combination of system and Python version, and this is also where I was otherwise able to observe the bug (Cygwin being a "system" for this purpose). On systems I tested other than Cygwin, it always completed successfully, printing all three messages, including with Python 3.9.18. On Cygwin, it likewise completed successfully when tested with Python 3.8.18 and 3.9.16, but showcased the problem on 3.9.18. As noted in the message I sent to the Cygwin mailing list, most of my testing was on my local machine, but it behaves accordingly on GitHub Actions. The maintainer will likely work on the issue soon. (Although it was after my list message that I added native Windows to the CI experiment, the situation with it is still essentially as described there. I have not built unpatched versions of Python 3.9.16 and 3.9.18 for Windows, and there are no official python.org Windows builds for 3.9 past 3.9.13. The native Windows 3.9.16 and 3.9.18 builds used in the CI experiment are downstream conda-forge builds. They are unlikely to differ in a way relevant to this, but it's not necessarily a perfect comparison.)
It might also be feasible to bisect using I'm unsure how straightforward bisection would be, because I don't know if all upstream commits that work for upstream builds will build or run correctly when built for Cygwin and with Cygwin patches applied. Even for releases, not all 3.9.z versions are packaged downstream for Cygwin. Although I recommend keeping the Cygwin python39 package pinned to 3.9.16-1 in GitPython's This is especially relevant to #1791, as it means that's probably already in the clear as far as this Cygwin issue is concerned, and nothing related to this has to be done there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks again for sharing and for taking the issue to the point where it's effectively fixed for everyone until a permanent fix is discovered by the maintainers - amazing work! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [GitPython](https://togithub.com/gitpython-developers/GitPython) | `==3.1.41` -> `==3.1.42` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>gitpython-developers/GitPython (GitPython)</summary> ### [`v3.1.42`](https://togithub.com/gitpython-developers/GitPython/releases/tag/3.1.42) [Compare Source](https://togithub.com/gitpython-developers/GitPython/compare/3.1.41...3.1.42) #### What's Changed - Fix release link in changelog by [@​PeterJCLaw](https://togithub.com/PeterJCLaw) in [https://github.com/gitpython-developers/GitPython/pull/1795](https://togithub.com/gitpython-developers/GitPython/pull/1795) - Remove test dependency on sumtypes library by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1798](https://togithub.com/gitpython-developers/GitPython/pull/1798) - Pin Sphinx plugins to compatible versions by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1803](https://togithub.com/gitpython-developers/GitPython/pull/1803) - fix: treeNotSorted issue by [@​et-repositories](https://togithub.com/et-repositories) in [https://github.com/gitpython-developers/GitPython/pull/1799](https://togithub.com/gitpython-developers/GitPython/pull/1799) - Remove git.util.NullHandler by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1807](https://togithub.com/gitpython-developers/GitPython/pull/1807) - Clarify why GIT_PYTHON_GIT_EXECUTABLE may be set on failure by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1810](https://togithub.com/gitpython-developers/GitPython/pull/1810) - Report actual attempted Git command when Git.refresh fails by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1812](https://togithub.com/gitpython-developers/GitPython/pull/1812) - Don't suppress messages when logging is not configured by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1813](https://togithub.com/gitpython-developers/GitPython/pull/1813) - Pin Python 3.9.16 on Cygwin CI by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1814](https://togithub.com/gitpython-developers/GitPython/pull/1814) - Have initial refresh use a logger to warn by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1815](https://togithub.com/gitpython-developers/GitPython/pull/1815) - Omit warning prefix in "Bad git executable" message by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1816](https://togithub.com/gitpython-developers/GitPython/pull/1816) - Test with M1 macOS CI runner by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1817](https://togithub.com/gitpython-developers/GitPython/pull/1817) - Bump pre-commit/action from 3.0.0 to 3.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/gitpython-developers/GitPython/pull/1818](https://togithub.com/gitpython-developers/GitPython/pull/1818) - Bump Vampire/setup-wsl from 2.0.2 to 3.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/gitpython-developers/GitPython/pull/1819](https://togithub.com/gitpython-developers/GitPython/pull/1819) - Remove deprecated section in README.md by [@​marcm-ml](https://togithub.com/marcm-ml) in [https://github.com/gitpython-developers/GitPython/pull/1823](https://togithub.com/gitpython-developers/GitPython/pull/1823) - Keep temp files out of project dir and improve cleanup by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1825](https://togithub.com/gitpython-developers/GitPython/pull/1825) #### New Contributors - [@​PeterJCLaw](https://togithub.com/PeterJCLaw) made their first contribution in [https://github.com/gitpython-developers/GitPython/pull/1795](https://togithub.com/gitpython-developers/GitPython/pull/1795) - [@​et-repositories](https://togithub.com/et-repositories) made their first contribution in [https://github.com/gitpython-developers/GitPython/pull/1799](https://togithub.com/gitpython-developers/GitPython/pull/1799) - [@​marcm-ml](https://togithub.com/marcm-ml) made their first contribution in [https://github.com/gitpython-developers/GitPython/pull/1823](https://togithub.com/gitpython-developers/GitPython/pull/1823) **Full Changelog**: gitpython-developers/GitPython@3.1.41...3.1.42 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/lettuce-financial/github-bot-signed-commit). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [GitPython](https://togithub.com/gitpython-developers/GitPython) | `==3.1.41` -> `==3.1.42` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>gitpython-developers/GitPython (GitPython)</summary> ### [`v3.1.42`](https://togithub.com/gitpython-developers/GitPython/releases/tag/3.1.42) [Compare Source](https://togithub.com/gitpython-developers/GitPython/compare/3.1.41...3.1.42) #### What's Changed - Fix release link in changelog by [@​PeterJCLaw](https://togithub.com/PeterJCLaw) in [https://github.com/gitpython-developers/GitPython/pull/1795](https://togithub.com/gitpython-developers/GitPython/pull/1795) - Remove test dependency on sumtypes library by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1798](https://togithub.com/gitpython-developers/GitPython/pull/1798) - Pin Sphinx plugins to compatible versions by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1803](https://togithub.com/gitpython-developers/GitPython/pull/1803) - fix: treeNotSorted issue by [@​et-repositories](https://togithub.com/et-repositories) in [https://github.com/gitpython-developers/GitPython/pull/1799](https://togithub.com/gitpython-developers/GitPython/pull/1799) - Remove git.util.NullHandler by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1807](https://togithub.com/gitpython-developers/GitPython/pull/1807) - Clarify why GIT_PYTHON_GIT_EXECUTABLE may be set on failure by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1810](https://togithub.com/gitpython-developers/GitPython/pull/1810) - Report actual attempted Git command when Git.refresh fails by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1812](https://togithub.com/gitpython-developers/GitPython/pull/1812) - Don't suppress messages when logging is not configured by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1813](https://togithub.com/gitpython-developers/GitPython/pull/1813) - Pin Python 3.9.16 on Cygwin CI by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1814](https://togithub.com/gitpython-developers/GitPython/pull/1814) - Have initial refresh use a logger to warn by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1815](https://togithub.com/gitpython-developers/GitPython/pull/1815) - Omit warning prefix in "Bad git executable" message by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1816](https://togithub.com/gitpython-developers/GitPython/pull/1816) - Test with M1 macOS CI runner by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1817](https://togithub.com/gitpython-developers/GitPython/pull/1817) - Bump pre-commit/action from 3.0.0 to 3.0.1 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/gitpython-developers/GitPython/pull/1818](https://togithub.com/gitpython-developers/GitPython/pull/1818) - Bump Vampire/setup-wsl from 2.0.2 to 3.0.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/gitpython-developers/GitPython/pull/1819](https://togithub.com/gitpython-developers/GitPython/pull/1819) - Remove deprecated section in README.md by [@​marcm-ml](https://togithub.com/marcm-ml) in [https://github.com/gitpython-developers/GitPython/pull/1823](https://togithub.com/gitpython-developers/GitPython/pull/1823) - Keep temp files out of project dir and improve cleanup by [@​EliahKagan](https://togithub.com/EliahKagan) in [https://github.com/gitpython-developers/GitPython/pull/1825](https://togithub.com/gitpython-developers/GitPython/pull/1825) #### New Contributors - [@​PeterJCLaw](https://togithub.com/PeterJCLaw) made their first contribution in [https://github.com/gitpython-developers/GitPython/pull/1795](https://togithub.com/gitpython-developers/GitPython/pull/1795) - [@​et-repositories](https://togithub.com/et-repositories) made their first contribution in [https://github.com/gitpython-developers/GitPython/pull/1799](https://togithub.com/gitpython-developers/GitPython/pull/1799) - [@​marcm-ml](https://togithub.com/marcm-ml) made their first contribution in [https://github.com/gitpython-developers/GitPython/pull/1823](https://togithub.com/gitpython-developers/GitPython/pull/1823) **Full Changelog**: gitpython-developers/GitPython@3.1.41...3.1.42 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/allenporter/flux-local). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
We pinned Python 3.9.16 on Cygwin CI in gitpython-developers#1814 (by requiring 3.9.16-1 as the exact version of the `python39` Cygwin package, along with other supporting changes). We did this to solve a problem where Python 3.9.18-1, which contained a bug that broke GitPython CI (and various other software), would be selected. Version 3.9.18-1 was marked back to being a "test" package shortly after the bug was reported, and was subsequently removed altogether from the Cygwin repositories. Because the affected package version effectively no longer exists, and because this issue is known and a non-"test" version still affected by it is very unlikely to be released in the future, this pinning has been decisively unnecessary for some time, though still not harmful. This commit undoes the pinning, so that the `python39` package can be installed at a higher version if one becomes available. This serves two purposes. - There is work under way in porting Python 3.12 to Cygwin. To test this with GitPython (either while it is in development or later), it will be useful to turn the Cygwin test job into a matrix job definition, generating two jobs, one for Python 3.9 and one for Python 3.12. Since 3.12 will probably not benefit from pinning, dropping pinning simplifies this. - If the port of Python 3.12 to Cygwin is successful, it might lead to a solution to the but that currently keeps 3.9.18 from being made available for Cygwin. In that case, another 3.9.18-* Cygwin package would be released, which we would want to use. Although this is uncertain, the change is a simplification, so I think it is reasonable to do now. Note that the pinning being undone here only affects the distinction between different 3.9.* versions. `python39` and `python312` are different Cygwin packages altogether, with correspondingly different `python39-*` and `python312-*` associated packages; this is not unpinning Python 3.9 in a way that would cause Python 3.12 to be selected instead of it.
We pinned Python 3.9.16 on Cygwin CI in gitpython-developers#1814 (by requiring 3.9.16-1 as the exact version of the `python39` Cygwin package, along with other supporting changes). We did this to solve a problem where Python 3.9.18-1, which contained a bug that broke GitPython CI (and various other software), would be selected. Version 3.9.18-1 was marked back to being a "test" package shortly after the bug was reported, and was subsequently removed altogether from the Cygwin repositories. Because the affected package version effectively no longer exists, and because this issue is known and a non-"test" version still affected by it is very unlikely to be released in the future, this pinning has been decisively unnecessary for some time, though still not harmful. This commit undoes the pinning, so that the `python39` package can be installed at a higher version if one becomes available. This serves two purposes. - There is work under way in porting Python 3.12 to Cygwin. To test this with GitPython (either while it is in development or later), it will be useful to turn the Cygwin test job into a matrix job definition, generating two jobs, one for Python 3.9 and one for Python 3.12. Since 3.12 will probably not benefit from pinning, dropping pinning simplifies this. - If the port of Python 3.12 to Cygwin is successful, it might lead to a solution to the but that currently keeps 3.9.18 from being made available for Cygwin. In that case, another 3.9.18-* Cygwin package would be released, which we would want to use. Although this is uncertain, the change is a simplification, so I think it is reasonable to do now. Note that the pinning being undone here only affects the distinction between different 3.9.* versions. `python39` and `python312` are different Cygwin packages altogether, with correspondingly different `python39-*` and `python312-*` associated packages; this is not unpinning Python 3.9 in a way that would cause Python 3.12 to be selected instead of it.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.