jenkinsci/git-client-plugin — pull request #7 by nwholloway (2013-03-23 08:16:33+00:00)
Title: Improve Git polling

Using "git show from..to" is not selecting the correct commits to calculate the changes. This can be demonstrated by looking at the output of "git show git-client-1.0.3..git-client-1.0.4" on the "git-client-plugin" -- it includes the initial commit.

This has two effects. The first is the polling was very slow in some cases, and the size of the output was large and the polling exhausted heap space.

I changed the implementation so that "git log" is used to determine the changes. This appears to select the correct changes, and has a dramatically shorter execution time.

I built a copy of the plugin, and installed it on the Jenkins installation displaying problems. Before this change, we had a job that would take 20 minutes, and then run out of heap space (it has infrequent builds compared to the rest of the repository).

> Started on 19-Mar-2013 17:05:07
> Using strategy: Default
> [poll] Last Built Revision: Revision 2b7fbea455c3905d5607b92966b61585d2a0504e (origin/blackpepper)
> Fetching changes from the remote Git repositories
> Polling for changes in
> FATAL: remote file operation failed: C:\Jenkins\workspace\log-auto at hudson.remoting.Channel@7e33df34:titan-desktop-2
> hudson.util.IOException2: remote file operation failed: C:\Jenkins\workspace\log-auto at hudson.remoting.Channel@7e33df34:titan-desktop-2
>	at hudson.FilePath.act(FilePath.java:848)
>	at hudson.FilePath.act(FilePath.java:834)
>	at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:706)
>	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:628)
>	at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
>	at hudson.scm.SCM.poll(SCM.java:373)
>	at hudson.model.AbstractProject._poll(AbstractProject.java:1402)
>	at hudson.model.AbstractProject.poll(AbstractProject.java:1335)
>	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:420)
>	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:449)
>	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
>	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>	at java.lang.Thread.run(Thread.java:662)
> Caused by: java.io.IOException: Remote call on titan-desktop-2 failed
>	at hudson.remoting.Channel.call(Channel.java:681)
>	at hudson.FilePath.act(FilePath.java:841)
>	... 16 more
> Caused by: java.lang.OutOfMemoryError: Java heap space
> Done. Took 20 min
> No changes

Subsequently, the polling log looks like:

> Started on 20-Mar-2013 09:49:13
> Using strategy: Default
> [poll] Last Built Revision: Revision 2b7fbea455c3905d5607b92966b61585d2a0504e (origin/blackpepper)
> Fetching changes from the remote Git repositories
> Fetching upstream changes from origin
> Polling for changes in
> Done. Took 18 sec