Push Causes Pre-Receive Hook Declined When Running Windows Server on XenServer
症状
When running Stash on a Windows Server instance that's sitting on top of XenServer pushes may fail with the following error:
To http://<user>@<server>/scm/<project>/<repo>.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://<user>@<server>/scm/<project>/<repo>.git'
atlassian-stash.log
に次のメッセージが表示される。
2014-11-03 16:28:12,530 ERROR [http-nio-7990-exec-8] <user> @12KOHN7x988x7762x0 127.0.0.1 "GET /scm/<project>/<repo>.git/info/refs HTTP/1.1" c.a.s.i.s.g.p.h.GitSmartExitHandler Request for repo '<repo>' of project '<project>' from '198.145.19.226' failed: read process 'D:\Git\cmd\git.exe http-backend' caused an exception
2014-11-03 16:28:12,563 DEBUG [http-nio-7990-exec-8] <user> @12KOHN7x988x7762x0 127.0.0.1 "GET /scm/<project>/<repo>.git/info/refs HTTP/1.1" c.a.s.i.s.g.p.h.GitSmartExitHandler process error:
com.atlassian.utils.process.ProcessNotStartedException: D:\Git\cmd\git.exe could not be started
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:332) ~[ExternalProcessImpl.class:na]
at com.atlassian.stash.scm.BaseCommand.doStart(BaseCommand.java:189) ~[BaseCommand.class:na]
at com.atlassian.stash.scm.BaseCommand.call(BaseCommand.java:72) ~[BaseCommand.class:na]
at com.atlassian.stash.internal.scm.git.protocol.http.GitSmartRequest.handleRequest(GitSmartRequest.java:94) [stash-scm-git-3.3.2.jar:na]
at com.atlassian.stash.internal.scm.git.protocol.http.OtherRead.handleRequest(OtherRead.java:18) [stash-scm-git-3.3.2.jar:na]
at com.atlassian.stash.scm.throttle.ThrottledScmRequestFactory$ThrottlingInvocationHandler.invoke(ThrottledScmRequestFactory.java:91) [ThrottledScmRequestFactory$ThrottlingInvocationHandler.class:na]
at com.atlassian.stash.internal.scm.ScmServlet.handleRequest(ScmServlet.java:55) [ScmServlet.class:na]
at org.springframework.web.context.support.HttpRequestHandlerServlet.service(HttpRequestHandlerServlet.java:68) [HttpRequestHandlerServlet.class:4.0.6.RELEASE]
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) [applinks-plugin-4.2.4_1408604932000.jar:na]
at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.onSuccess(StashAuthenticationFilter.java:224) [StashAuthenticationFilter.class:na]
at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:101) [StashAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:111) [BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:77) [BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:100) [TrustedApplicationsFilter.class:na]
at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69) [atlassian-oauth-service-provider-plugin-1.9.2_1408604934000.jar:na]
at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:33) [analytics-client-3.48_1411424420000.jar:na]
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31) [AbstractHttpFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:89) [BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75) [BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:84) [DefaultRequestManager.class:na]
at com.hazelcast.web.WebFilter.doFilter(WebFilter.java:450) [WebFilter.class:3.3-RC3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_55]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_55]
... 181 frames trimmed
Caused by: java.io.IOException: Cannot run program "D:\Git\cmd\git.exe" (in directory "C:\Atlassian\ApplicationData\Stash\shared\data\repositories\12"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source) ~[na:1.7.0_55]
at com.atlassian.utils.process.ExternalProcessImpl.createDefaultProcess(ExternalProcessImpl.java:367) ~[ExternalProcessImpl.class:na]
at com.atlassian.utils.process.ExternalProcessImpl.createProcess(ExternalProcessImpl.java:375) ~[ExternalProcessImpl.class:na]
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:329) ~[ExternalProcessImpl.class:na]
... 23 common frames omitted
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method) ~[na:1.7.0_55]
at java.lang.ProcessImpl.<init>(Unknown Source) ~[na:1.7.0_55]
at java.lang.ProcessImpl.start(Unknown Source) ~[na:1.7.0_55]
... 27 common frames omitted
This is related to Stash Stuck at Empty Repository Screen after Push When Running Windows Server on XenServer.
診断
Rackspace Windows servers run on top of Xen and are affected by this.
In the Application Logs under Event Viewer you will see errors similar to the following where bash.exe
is not able to execute:
Faulting application name: bash.exe, version: 0.0.0.0, time stamp: 0x5429d9fa
Faulting module name: ntdll.dll, version: 6.3.9600.17278, time stamp: 0x53eeb4a3
Exception code: 0x40010006
Fault offset: 0x0009a792
Faulting process id: 0xd90
Faulting application start time: 0x01cff937d7c022e0
Faulting application path: d:\Git\bin\bash.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 156e1ced-652b-11e4-80c9-bc764e10bbfd
Faulting package full name:
Faulting package-relative application ID:
原因
This is caused by a bug between msysgit and XenServer. A discussion of this can be found at https://lists.xenserver.org/sympa/arc/xs-devel/2014-07/msg00060.html
回避策
Uninstalling XenServer Tools may allow msysgit to function properly. Please use caution as uninstalling XenServer Tools could leave your instance inaccessible or have serious performance impacts.
If you're using a server hosted by Rackspace, do not uninstall XenServer Tools.
ソリューション
This bug is being tracked on the msysgit issue tracker at https://github.com/msysgit/git/issues/248
Unfortunately, until this bug is fixed the resolution is to switch to using Linux as it is not affected by this bug.