metasim
metasim

Reputation: 4970

Hudson + Windows + GitHub + Git Plugin = really really slow fetch stage

I'm setting up my first Hudson + Git project (previously done many with Hudson + SVN). I expected the clone stage to be slow, as our repository is quite large, but subsequent builds where a fetch + merge is being used are just as long. The following options are enabled:

I am not doing a "Wipe out workspace".

...
Fetching changes from the remote Git repository
Fetching upstream changes from [email protected]:username/ProjectFoo.git
[Foo] $ git fetch -t [email protected]:username/ProjectFoo.git +refs/heads/*:refs/remotes/origin/*

At this point it stalls for a very long time. Once it finally finishes, it appears to progress as expected:

[Foo] $ git ls-tree HEAD
[Foo] $ git rev-parse origin/mybranch
Commencing build of Revision c883d59dd5a506a0b586f679a256f539712bfccc (origin/mybranch)
GitAPI created
Checking out Revision c883d59dd5a506a0b586f679a256f539712bfccc (origin/mybranch)
[Foo] $ git checkout -f c883d59dd5a506a0b586f679a256f539712bfccc
[Foo] $ git tag -a -f -m "Hudson Build #2" hudson-Foo-2
Recording changes in branch origin/mybranch
[Foo] $ git whatchanged --no-abbrev -M --pretty=raw c883d59dd5a506a0b586f679a256f539712bfccc..c883d59dd5a506a0b586f679a256f539712bfccc
Cleaning workspace
[Foo] $ git clean -fdx
...

When I run the same fetch command from the Git Bash command line, it runs almost instantaneously.

Any idea what might be going on? Or hints to speed things up? Note, the cloned repository is 210MB. (About a decade's worth of code history.)

Upvotes: 3

Views: 3185

Answers (3)

Yuxiang
Yuxiang

Reputation: 21

This might be a late answer. but it does solve the extreme-slow problem when Jenkins/Hudson runs as a windows service, on my environment.
The key point is to make git get the rsa keys in a windows service account! I made it works as below:

  1. open Control Panel->Administrative Tools-> Services, and find "Jenkins".
  2. Right click to open Properties->Log On, and assign Jenkins Log On as a user with administrator access.
  3. restart Jenkins, and "git fetch" goes lightning as it is on linux.

The solution provided by ccutrer, did not work for me in the original trial, because plink cannot get rsa key from pageant (pageant is in another user session!). When my steps deployed, either openssh and plink could work well by then.

Upvotes: 2

ccutrer
ccutrer

Reputation: 396

I've run into this problem as well, and figured out a workaround. When Hudson runs as a service, something is missing that your normal desktop environment has, which causes something to do with the network to have to re-load for each process. msys-1.0.dll attempts to load something in netapi32.dll which causes it to take so long. So I just downloaded plink.exe from PuTTY, and set my GIT_SSH env to use that instead. Problem averted.

Upvotes: 8

VonC
VonC

Reputation: 1329692

Could you try an anonymous access instead of an authenticated one for your fetch?

$ git config remote.origin.url git://github.com/username/ProjectFoo.git   # read-only
$ git config remote.origin.pushurl [email protected]:username/ProjectFoo.git # authenticated

and see if the fetch is still slow within the Hudson job?

See for illustration "Using Github with MsysGit".

Upvotes: 1

Related Questions