• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None

      We are seeing hung git processes which seem to be left over from when Jenkins is using Git to poll for changes. This is likely because there was some IO problem (disk or network) when the polling was attempted. Instead of hanging forever, the fetch should eventually timeout.

          [JENKINS-11286] Git plugin does not timeout

          Joel Gallant added a comment - - edited

          I noticed it mentioned as a system property in 1.4.6 - (org.jenkinsci.plugins.gitclient.Git.timeout).

          I tried setting this in the launch, and it shows in the environment variables, but doesn't appear to do anything - my timeout is still @10 minutes...

          Joel Gallant added a comment - - edited I noticed it mentioned as a system property in 1.4.6 - (org.jenkinsci.plugins.gitclient.Git.timeout). I tried setting this in the launch, and it shows in the environment variables, but doesn't appear to do anything - my timeout is still @10 minutes...

          Joel Gallant added a comment -

          Ah! Now I see, it's in the 1.4.x maintenance branch!

          Joel Gallant added a comment - Ah! Now I see, it's in the 1.4.x maintenance branch!

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
          http://jenkins-ci.org/commit/git-client-plugin/1b7fd2b18d626d8ca081933d8a004fd7b2279210
          Log:
          JENKINS-11286 run git commands with a time-out

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java http://jenkins-ci.org/commit/git-client-plugin/1b7fd2b18d626d8ca081933d8a004fd7b2279210 Log: JENKINS-11286 run git commands with a time-out

          Don Ross added a comment -

          Why, oh why, was this implemented without an option to disable it?

          Don Ross added a comment - Why, oh why, was this implemented without an option to disable it?

          Steve Cohen added a comment - - edited

          Agree with Don Ross

          I have a valid, albeit rare, use case for running without a timeout.  Given a large job with git LFS objects that change infrequently, it might take 5 or 6 hours for the original download.  Being able to specify no timeout would be a good thing here.  Is there some values (say, maybe -1) that means don't time out?  Once the initial LFS stuff is checked out timeouts are again reasonable.

          Steve Cohen added a comment - - edited Agree with Don Ross I have a valid, albeit rare, use case for running without a timeout.  Given a large job with git LFS objects that change infrequently, it might take 5 or 6 hours for the original download.  Being able to specify no timeout would be a good thing here.  Is there some values (say, maybe -1) that means don't time out?  Once the initial LFS stuff is checked out timeouts are again reasonable.

          Mark Waite added a comment -

          sc1478 there is no value which means "don't time out".

          I don't see much difference for your use case between a very large number and no timeout. If you set the timeout to 1000000 minutes, it seems unlikely that you'll reach the timeout before either interrupting the job, restarting Jenkins, or rebooting the computer.

          Mark Waite added a comment - sc1478 there is no value which means "don't time out". I don't see much difference for your use case between a very large number and no timeout. If you set the timeout to 1000000 minutes, it seems unlikely that you'll reach the timeout before either interrupting the job, restarting Jenkins, or rebooting the computer.

          Steve Cohen added a comment - - edited

          True enough Mark Waite.  However, see JENKINS-47616, wherein I request making this parameterizable, since with Git-LFS the initial checkout is much slower than subsequent ones.

          Parameterization is key, since otherwise you must keep messing around with configurations otherwise.

          Steve Cohen added a comment - - edited True enough Mark Waite.  However, see JENKINS-47616 , wherein I request making this parameterizable, since with Git-LFS the initial checkout is much slower than subsequent ones. Parameterization is key, since otherwise you must keep messing around with configurations otherwise.

          Patrick B added a comment -

          Hey guys,

           

          in which file I can find this option? `org.jenkinsci.plugins.gitclient.Git.timeOut`

          I searched in all administrative areas and not find it.
          -> YES on each project I can add this as additional configuration.

          But I want this global on all projects without that people must set it up every time.

          (On Windows, I checked config.xml, settings.xml, plugins-settings.xml and everything)

          Patrick B added a comment - Hey guys,   in which file I can find this option? `org.jenkinsci.plugins.gitclient.Git.timeOut` I searched in all administrative areas and not find it. -> YES on each project I can add this as additional configuration. But I want this global on all projects without that people must set it up every time. (On Windows, I checked config.xml, settings.xml, plugins-settings.xml and everything)

          Mark Waite added a comment -

          patrick_i if your users need to increase the timeout generally, then I think you may have missed an opportunity to help your users with faster clones. Refer to the Jenkins World 2017 15 minute talk on "git in the large" (slides).

          For example, cloning a large git repository can be significantly reduced with a reference repository. Cloning a large git repository can be significantly reduced by using a narrow refspec. Cloning a large git repository can be significantly reduced with shallow clone.

          Even with the best of techniques, there still may be times when you choose to attempt to adjust the global git client plugin timeout value. That requires a change of the command line parameters used to start Jenkins. There is no user interface support for global adjustment of the git client plugin timeout value.

          In general, the Java process which starts Jenkins needs the argument -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=12345

          Refer to my docker_run.py script as one example of a way to pass that argument to the java command which starts Jenkins. If your Jenkins starts from an init script on Ubuntu or Debian, you may be able to adjust command line arguments from /etc/defaults/jenkins. If your Jenkins starts from an init script on Red Hat, CentOS, OpenSUSE, or SUSE, you may be able to adjust command line arguments in /etc/sysconfig/jenkins. If your Jenkins is a service on Windows, I believe there is a configuration file that can be changed to add arguments to the Java command line which starts Jenkins.

          Mark Waite added a comment - patrick_i if your users need to increase the timeout generally, then I think you may have missed an opportunity to help your users with faster clones. Refer to the Jenkins World 2017 15 minute talk on " git in the large " ( slides ). For example, cloning a large git repository can be significantly reduced with a reference repository. Cloning a large git repository can be significantly reduced by using a narrow refspec. Cloning a large git repository can be significantly reduced with shallow clone. Even with the best of techniques, there still may be times when you choose to attempt to adjust the global git client plugin timeout value. That requires a change of the command line parameters used to start Jenkins. There is no user interface support for global adjustment of the git client plugin timeout value. In general, the Java process which starts Jenkins needs the argument -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=12345 Refer to my docker_run.py script as one example of a way to pass that argument to the java command which starts Jenkins. If your Jenkins starts from an init script on Ubuntu or Debian, you may be able to adjust command line arguments from /etc/defaults/jenkins. If your Jenkins starts from an init script on Red Hat, CentOS, OpenSUSE, or SUSE, you may be able to adjust command line arguments in /etc/sysconfig/jenkins. If your Jenkins is a service on Windows, I believe there is a configuration file that can be changed to add arguments to the Java command line which starts Jenkins.

          Patrick B added a comment -

          @markewaite: Thank you very much.
          I understand that it is more professional if we fix the problem in general instead using larger timeouts.
          So I will check your slides in the next weeks but for the moment I added this command.

           

          For everybody Windows users else:
          C:\Program Files (x86)\Jenkins\jenkins.xml

          There you scroll down to service and arguments. There you can add this:

           -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60
          

           

          And then your log file shows # timeout=60 and everything is fine 

           

          Patrick B added a comment - @ markewaite : Thank you very much. I understand that it is more professional if we fix the problem in general instead using larger timeouts. So I will check your slides in the next weeks but for the moment I added this command.   For everybody Windows users else: C:\Program Files (x86)\Jenkins\jenkins.xml There you scroll down to service and arguments . There you can add this:  -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60   And then your log file shows # timeout=60 and everything is fine   

            ndeloof Nicolas De Loof
            recampbell Ryan Campbell
            Votes:
            6 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved: