2017-07-04 30 views
0

我有我的服務器上運行Jenkins通過webhooks與GitHub連接。不幸的是,我的構建偶爾失敗,我不明白爲什麼。有時重新啓動詹金斯(sudo service jenkins restart)解決了問題,有時它不。服務器運行Ubuntu 16.04 nginx作爲代理。造成這個問題的原因是什麼?我該如何解決?Jenkins「錯誤克隆遠程回購'起源'」和「無法分配內存」

Started by GitHub push by gaboratorium 
Building in workspace /var/lib/jenkins/workspace/kudos.gaboratorium.com 
[WS-CLEANUP] Deleting project workspace... 
[WS-CLEANUP] Done 
Cloning the remote Git repository 
Cloning repository https://github.com/gaboratorium/kudos.git 
> git init /var/lib/jenkins/workspace/kudos.gaboratorium.com # timeout=10 
Fetching upstream changes from https://github.com/gaboratorium/kudos.git 
> git --version # timeout=10 
> git fetch --tags --progress https://github.com/gaboratorium/kudos.git 
+refs/heads/*:refs/remotes/origin/* 
ERROR: Error cloning remote repo 'origin' 
hudson.plugins.git.GitException: Command "git fetch --tags --progress 
https://github.com/gaboratorium/kudos.git 
+refs/heads/*:refs/remotes/origin/*" returned status code 128: 
stdout: 
stderr: error: cannot fork() for fetch-pack: Cannot allocate memory 

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1622) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:348) 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:545) 
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1070) 
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1110) 
at hudson.scm.SCM.checkout(SCM.java:495) 
at hudson.model.AbstractProject.checkout(AbstractProject.java:1276) 
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:560) 
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:485) 
at hudson.model.Run.execute(Run.java:1735) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
at hudson.model.ResourceController.execute(ResourceController.java:97) 
at hudson.model.Executor.run(Executor.java:405) 
ERROR: Error cloning remote repo 'origin' 
Finished: FAILURE 
+0

這個錯誤怎麼樣:'stderr:error:can not fork()for fetch-pack:Can not allocate memory'? – Edwin

回答

2

使用df -hdu -sh $JENKINS_HOME,以檢查是否有足夠的內存詹金斯分配。

+0

感謝您的回答!我已經跑了,但我不太清楚我應該找什麼。對我來說似乎很好。 屏幕截圖:http://prntscr.com/frv2he –

+0

你的磁盤似乎有足夠的空間。我認爲你缺乏內存。試試這裏'ps --sort -rss -eo rss,pid,command | head'。從這裏盜取https://askubuntu.com/questions/253466/why-am-i-frequently-getting-this-cannot-allocate-memory-error。 – arifCee

+0

這也看起來很好:http://prntscr.com/frvus7 –