We are having trouble with msdelploy.exe hanging on our TeamCity CI server. It basically hangs indefinitely. Here is the thread dump from TeamCity:
Process is running under CLR version: v4.0.30319 Thread id=5764 M-->U [IL Method without Metadata] at System.Net.Sockets.Socket.Receive(System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags, System.Net.Sockets.SocketError& errorCode) at System.Net.Sockets.NetworkStream.Read(System.Byte[] buffer, System.Int32 offset, System.Int32 size) at System.Net.FixedSizeReader.ReadPacket(System.Byte[] buffer, System.Int32 offset, System.Int32 count) at System.Net.Security._SslStream.StartFrameHeader(System.Byte[] buffer, System.Int32 offset, System.Int32 count, System.Net.AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.StartReading(System.Byte[] buffer, System.Int32 offset, System.Int32 count, System.Net.AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessRead(System.Byte[] buffer, System.Int32 offset, System.Int32 count, System.Net.AsyncProtocolRequest asyncRequest) at System.Net.TlsStream.Read(System.Byte[] buffer, System.Int32 offset, System.Int32 size) at System.Net.PooledStream.Read(System.Byte[] buffer, System.Int32 offset, System.Int32 size) at System.Net.Connection.SyncRead(System.Net.HttpWebRequest request, System.Boolean userRetrievedStream, System.Boolean probeRead) at System.Net.ConnectStream.ProcessWriteCallDone(System.Net.ConnectionReturnResult returnResult) at System.Net.HttpWebRequest.GetResponse() at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponse(System.Net.HttpWebRequest request) at Microsoft.Web.Deployment.AgentClientProvider.RemoteDestSync(Microsoft.Web.Deployment.DeploymentObject sourceObject, Microsoft.Web.Deployment.DeploymentSyncContext syncContext, System.Nullable<System.Int32> syncPass) at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(Microsoft.Web.Deployment.DeploymentObject destObject, Microsoft.Web.Deployment.DeploymentSyncOptions syncOptions, Microsoft.Web.Deployment.PayloadTable payloadTable, Microsoft.Web.Deployment.ContentRootTable contentRootTable, System.Nullable<System.Int32> syncPassId) at Microsoft.Web.Deployment.DeploymentObject.SyncTo(Microsoft.Web.Deployment.DeploymentProviderOptions providerOptions, Microsoft.Web.Deployment.DeploymentBaseOptions baseOptions, Microsoft.Web.Deployment.DeploymentSyncOptions syncOptions) at MSDeploy.MSDeploy.HandleAuxillarySync(System.String syncType, System.Collections.Generic.Dictionary<System.String, System.String> sourceParameters, Microsoft.Web.Deployment.DeploymentBaseOptions destBaseOptions) at MSDeploy.MSDeploy.ExecuteWorker() at MSDeploy.MSDeploy.Execute() at MSDeploy.MSDeploy.Main(System.String[] unusedArgs) Thread id=1292 U-->M Thread id=1288 at Microsoft.Web.Deployment.PackageSerializerKeepAliveTable.KeepAliveThread() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) at System.Threading.ThreadHelper.ThreadStart() U-->M
We invoke msdeploy in the following fashion:
C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe -verb:sync -source:dirPath="C:\Solution\Reporting\" -dest:computerName=MYSERVER?site=services,userName=USERNAME,password=PASSWORD,authType=basic,dirPath="C:\Services\" -allowUntrusted -postSync:runCommand="C:\Solution\Deploy\PostSync.cmd",waitInterval=300000
The PostSync.cmd looks like this (where TeamCity is simply a param we pass to our .ps1 script):
powershell -inputformat none -ExecutionPolicy Unrestricted -noninteractive c:\services\Deploy\CreateSSISCatalog.ps1 TeamCity exit /B %ERRORLEVEL%<div>The build step appears to run just fine and we get this output in our build log:</div><div>
[00:58:03][Step 4/6] [00:58:03][Step 4/6] Info: C:\Windows\system32> [00:58:03][Step 4/6] Info: exit [00:58:03][Step 4/6] Info: /B 0 [00:58:03][Step 4/6] Info: [00:58:03][Step 4/6] [00:58:03][Step 4/6] Warning: The process 'C:\Windows\system32\cmd.exe' (command line '') exited with code '0x0'. [09:29:45][Step 4/6] Process exited with code 1 [09:29:45][Step 4/6] Step Deploy SSIS (Command Line) interruptedBut as you can see it has hung for 8 hours and we have to kill it manually. Strange thing is the PostSync.cmd batch file output appears to have completed, yet msdeploy.exe is still waiting on something.</div> <div></div>