GitPython icon indicating copy to clipboard operation
GitPython copied to clipboard

kill_after_timeout doesn't seem to affect clone_from function

Open RT4U opened this issue 4 years ago • 8 comments

As mentioned in the title, it just doesn't seem to work. I've tried passing as_process=False as mentioned in another issue, but that ends up in duplicate keyword args exception.

repo = git.Repo.clone_from(url, repo_folder_name, progress=None, quiet=True, filter="tree:0", no_checkout=True, depth=20, config="core.gitproxy=/home/git/git-proxy", kill_after_timeout=10)

RT4U avatar Apr 19 '21 12:04 RT4U

Could you provide an example that is reproducible by executing a python script?

as_process is false by default and doesn't need to be passed in order to allow for kill_after_timeout to work.

Byron avatar Apr 20 '21 01:04 Byron

Could you provide an example that is reproducible by executing a python script?

as_process is false by default and doesn't need to be passed in order to allow for kill_after_timeout to work.

This is what I am basically trying to do the issue mentioned here.

https://github.com/gitpython-developers/GitPython/issues/892

I am cloning multiple repos running in a multiprocessing environment, after cloning some of the repos, the git process seems to hang on some causing the entire script to slow down ultimately hanging the whole script. Upon looking at the debug errors, it looks it's stuck in a clone_from call. So what I had to do was to kill the process after a 10 second timeout, but it wouldn't happen either.

RT4U avatar Apr 20 '21 09:04 RT4U

Thanks a lot for the additional description. However, it's not what could move this issue forward as there is no way to reproduce it.

Thus I am closing it but will be happy to reopen once a script was provided. Producing it may help to better understand how the kill_after_timeout flag is working, and maybe even shed some light on why it is not working in the case stated here.

Byron avatar Apr 21 '21 05:04 Byron

Hey, This is still a problem. repro:


import git

 git.Repo.clone_from(
            "https://github.com/trustwallet/assets",
            "/tmp/output",
            depth=1,
            kill_after_timeout=0.1 # <--- This will never bail
        )

aviadhahami avatar Nov 02 '22 02:11 aviadhahami

Thanks for the script, appreciated. For completeness, which OS/platform are you testing on and which GitPython version are you using (along with the python interpreter version)? Thanks again.

Byron avatar Nov 02 '22 08:11 Byron

Running in a Linux container python:3.9 uname -a ===> Linux 58726903057c 5.10.124-linuxkit #1 SMP Thu Jun 30 08:19:10 UTC 2022 x86_64 GNU/Linux Python == 3.9.13 GitPython == 3.1.27

aviadhahami avatar Nov 04 '22 18:11 aviadhahami

@Byron I may have some time to look into soon :)

aviadhahami avatar Nov 07 '22 08:11 aviadhahami

It seems that because _clone uses the as_process=True the kill_after_timeout argument is completely ignored... Maybe it's better to add another handling of this argument when calling the communicate method

3droj7 avatar Jul 25 '23 11:07 3droj7