Git timeout when cloning a large repository

I am trying to build my project but I get these errors:

The recommended git tool is: NONE
No credentials specified
/usr/bin/git rev-parse --resolve-git-dir /home/maryam/RDTK/jenkins/jobs/openface-cpp-OpenFace_2.2.0-toolkit-floka-minimal-nightly/workspace/.git # timeout=10
Fetching changes from the remote Git repository
/usr/bin/git config remote.origin.url GitHub - TadasBaltrusaitis/OpenFace: OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation. # timeout=10 Cleaning workspace
/usr/bin/git rev-parse --verify HEAD # timeout=10
No valid HEAD. Skipping the resetting
/usr/bin/git clean -fdx # timeout=10
Fetching upstream changes from GitHub - TadasBaltrusaitis/OpenFace: OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
/usr/bin/git --version # timeout=10
git --version # ‘git version 2.17.1’
/usr/bin/git fetch --tags --progress --/TadasBaltrusaitis/OpenFace.git +refs/heads/:refs/remotes/origin/ # timeout=10
ERROR: Timeout after 10 minutes

ERROR: Error fetching remote repo ‘origin’
hudson.plugins.git.GitException: Failed to fetch from github/TadasBaltrusaitis/OpenFace.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1001)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1242)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1302)
at hudson.scm.SCM.checkout(SCM.java:505)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1213)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:637)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:509)
at hudson.model.Run.execute(Run.java:1888)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:99)
at hudson.model.Executor.run(Executor.java:432)
Caused by: hudson.plugins.git.GitException: Command “/usr/bin/git fetch --tags --progress – github/TadasBaltrusaitis/OpenFace.git +refs/heads/:refs/remotes/origin/” returned status code 128:
stdout:
stderr: remote: Enumerating objects: 21343, done.
remote: Counting objects: 33% (1/3)
remote: Counting objects: 66% (2/3)
remote: Counting objects: 100% (3/3)
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 33% (1/3)
remote: Compressing objects: 66% (2/3)
remote: Compressing objects: 100% (3/3)
remote: Compressing objects: 100% (3/3), done.
Receiving objects: 0% (1/21343)
Receiving objects: 1% (214/21343)
Receiving objects: 2% (427/21343)
Receiving objects: 3% (641/21343)
Receiving objects: 4% (854/21343)
Receiving objects: 5% (1068/21343)

fatal: index-pack failed
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2096) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:618)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)
… 11 more 04:12:02 ERROR: Error fetching remote repo ‘origin’
Finished: FAILURE

Can anybody help me?

Why Is it taking more than 10 min to check out? Network? Disk? Cpu?

I’m sure there are ways to increase that timeout but it seems like a really long time

1 Like

Do you mean that it can be because of network, CPU, or disk of my system?

All I can say is that your really long stack trace is causes by git timing out.

Why it times out I don’t know. Could be a Network issue where firewall is dropping the connection so it waits forever for something that never comes.
Could also be network where download speeds are slow and the repo is large.
Could be disk if the repo has lots of large files and the disk is busy.
Or any number of other factors.

The easiest way to remove variables is make a new repo with a couple small files. If you can run a job on the new repo, then it’s unlikely (but not impossibly) network.

1 Like

@halkeye is correct that the git plugin is using its default 10 minute timeout and has not completed the fetch of the remote repository in that 10 minutes. If that repository is GitHub - TadasBaltrusaitis/OpenFace: OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation., then the issue is that you’re trying to clone a repository over the internet that is probably well over 2 GB. I stopped my clone of it at 25% complete with over 500MB of data transferred. Yes, it can be done, but it will need more than 10 minutes to do it over most internet connections.

That is a very large repository. For comparison, it appears that repository is at least as large as one of the most active repositories in the world, the Linux kernel. The Linux kernel was the first project to use git and has been using it for frequent commits for many, many years.

There are techniques that will allow Jenkins to operate more effectively with a large repository. You’ll need to spend time to identify which of the techniques is most useful for you with your use case and that large repository.

I presented a five minute talk at DevOps World on some alternatives that you can use to make it more manageable to work with large repositories. The ideas in that talk won’t solve all the problems but they can significantly improve things.

1 Like