Jenkins time-out while fetching from Github in 10 mins.

↘锁芯ラ 提交于 2019-12-02 17:10:58

I was about to use Workaround #2 but it seems as of git plugin 2.0.3 this can now be configured in the UI, although it is a bit hidden away and is per project.

Go to the configure screen for a project, Source Code Management section, Git, Additional Behaviors, Add, Advanced clone behaviors, Timeout (in minutes) for clone and fetch operation.

I would use workaround #2 as suggested by DevHopeful_2012 if you want a global setting.

kevinmm

It looks like this is a known issue. See JENKINS-20445, JENKINS-20387, and several other issues, which seem to be popping up.

According to these bug reports, this is only happening in the newer version of the Git plugin, so you could downgrade, or try some workarounds:


Workaround #1 - create a local bare reference clone to reduce the time, as stated here.

If you have only 30 kb/second throughput from Jenkins to your git repository, you should probably consider cloning a bare copy of the repository to central location on the Jenkins server, then perform the clone with the "Advanced clone behaviour" to use a reference repository. That will significantly reduce the amount of data transferred from the git server to Jenkins.

On my Debian Jenkins machine, I do that with:

$ sudo mkdir -p /var/cache/git/mwaite
$ sudo chown mwaite.mwaite /var/cache/git/mwaite
$ cd /var/cache/git/mwaite
$ git clone --bare https://github.com/jenkinsci/jenkins.git

After that bare clone is available on the Jenkins machine, add that advanced behavior to the job and it should perform much better.


Workaround #2 - increase the timeout to allow for the long initial clone process to complete, using the Git.timeOut property:

java -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60 -jar jenkins.war

This SO question is a good example of how to set properties for the Jenkins service. Also, note that this value is in minutes and not seconds. This workaround is courtesy of David.


The latter workaround worked for me. Although, I must admit that I'd prefer to use the reference repo, but I don't believe that it works with a multiconfiguration job, such as mine. And, be forewarned that it was surprisingly painful to set a property for every slave node and then internally document that we have to set this on all nodes, using large Git repos, going forward.

WINDOWS ONLY

There is a possibility that your ssh connection is not configured properly. If the ssh connection to your git repository is not estabilished, Jenkins build may appear as if it hung and eventually timeout.

By default, the Jenkins installer sets up Jenkins to run as a service, which runs as the “Local System account”, NOT your user account. Since the “Local System account” does not have SSH keys or known_hosts set up, “git clone” will fail.

You can just copy C:\Program Files (x86)\Git\.ssh to C:\Windows\SysWOW64\config\systemprofile\.ssh (the “Local System account” home)

Also,

IMPORTANT: make sure your ssh keys do NOT have a password! Jenkins will appear to hang when cloning the repository, but really it’s ssh blocking in the background waiting for you to input your password.

Detailed steps in http://computercamp-cdwilson-us.tumblr.com/post/48589650930/jenkins-git-clone-via-ssh-on-windows-7-x64

I just found the solution for jenkins timout #10 min errors. This error was coming because of low Internet connection or may be the size of you project in github is large, so jenkins not able load that project from git server.For resolve the problem we have to edit "Additional Behaviours" in Git in jenkins project configuration and increase "Timeout (in minutes) for clone and fetch operations" to "60" or "120" minutes. So now whenever jenkins clone the git project from git server, its enough time to load/clone a project from git server.

In Ubuntu 14.04 lts

Goto /etc/default/jenkins edit with vi or gedit

update java orgs like below

Before update, it will be like JAVA_ARGS="-Djava.awt.headless=true"

Update like below JAVA_ARGS="-Djava.awt.headless=true -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=30"

and restart jenkins like

sudo /etc/init.d/jenkins start

Workaround #2 worked for me, I had to change jenkins.xml file.

On Windows:

  1. Go to C:\Program Files (x86)\Jenkins
  2. open jenkins.xml file
  3. add -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60 inside <arguments> tag

This is how my configuration looks like

Before:

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

After:

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60 -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

On CentOS/RedHat 7.4 Linux with Jenkins-2.138

Edit /etc/sysconfig/jenkins, modify the JENKINS_ARGS (last line) with the timeout setting mentioned by others in their answers:

# Pass arbitrary arguments to Jenkins.
# Full option list: java -jar jenkins.war --help
#
JENKINS_ARGS="-Dorg.jenkinsci.plugins.gitclient.Git.timeOut=25"
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!