TFS测试生成缓慢,在几分钟内{vstest.console.exe,TcpClientExtensions.MessageLoopAsync:在remoteEndPoint上轮询:”挂起

时间:2019-05-03 09:23:39

标签: tfs vstest

我有大约250个测试用例的构建定义,这些定义开始非常缓慢地运行测试用例。它运行了将近100个测试用例,最后每个测试用例大约要花费8分钟。此时有100多个测试用例,这是我们无法忍受的。 我设法在服务器上获得了一些日志记录,一旦它开始变慢,它就记录了诊断日志:

...
9060, 5, 2019/05/03, 09:52:32.127, 179576170847, vstest.console.exe, TestRunRequest:SendTestRunStatsChange: Completed.
...
18356, 5, 2019/05/03, 09:59:27.108, 169578763371, vstest.console.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:51949 localEndPoint: 127.0.0.1:51948
18356, 5, 2019/05/03, 09:59:28.108, 169581006890, vstest.console.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:51949 localEndPoint: 127.0.0.1:51948
18356, 5, 2019/05/03, 09:59:29.108, 169583250453, vstest.console.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:51949 localEndPoint: 127.0.0.1:51948
18356, 5, 2019/05/03, 09:59:30.108, 169585493854, vstest.console.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:51949 localEndPoint: 127.0.0.1:51948
...

在主机日志中:


...
TpTrace Verbose: 0 : 18304, 9, 2019/05/03, 09:59:28.405, 169581673025, testhost.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:51948 localEndPoint: 127.0.0.1:51949
TpTrace Verbose: 0 : 18304, 9, 2019/05/03, 09:59:29.405, 169583916411, testhost.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:51948 localEndPoint: 127.0.0.1:51949
TpTrace Verbose: 0 : 18304, 9, 2019/05/03, 09:59:30.405, 169586159896, testhost.exe, TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: 127.0.0.1:51948 localEndPoint: 127.0.0.1:51949
TpTrace Verbose: 0 : 18304, 9, 2019/05/03, 09:59:30.936, 169587383747, testhost.exe, TcpClientExtensions.MessageLoopAsync: NotifyDataAvailable remoteEndPoint: 127.0.0.1:51948 localEndPoint: 127.0.0.1:51949
TpTrace Error: 0 : 18304, 9, 2019/05/03, 09:59:30.983, 169587459527, testhost.exe, Socket: Message loop: failed to receive message due to socket error System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.Stream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at System.IO.BinaryReader.ReadString()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken), remoteEndPoint: 127.0.0.1:51948 localEndPoint: 127.0.0.1:51949
TpTrace Information: 0 : 18304, 9, 2019/05/03, 09:59:30.983, 169587461935, testhost.exe, SocketClient.PrivateStop: Stop communication from server endpoint: 127.0.0.1:051948, error:System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.Stream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at System.IO.BinaryReader.ReadString()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken)
TpTrace Information: 0 : 18304, 28, 2019/05/03, 09:59:30.983, 169587468526, testhost.exe, DefaultEngineInvoker.SetParentProcessExitCallback: ParentProcess '18356' Exited.
TpTrace Verbose: 0 : 18304, 9, 2019/05/03, 09:59:30.983, 169587472928, testhost.exe, LengthPrefixCommunicationChannel.Dispose: Dispose reader and writer.
TpTrace Verbose: 0 : 18304, 9, 2019/05/03, 09:59:30.983, 169587473097, testhost.exe, TcpClientExtensions.MessageLoopAsync: exiting MessageLoopAsync remoteEndPoint: 127.0.0.1:51948 localEndPoint: 127.0.0.1:51949

问题总是在同一地点开始,并且似乎与测试用例无关,我在那段时间试图忽略一些测试用例,它将跳过那些但仍然遇到相同的问题。

构建服务器是Windows 2012 R2 Standard安装,最新版本的Visual Studio 2017 Enterprise已更新(15.9.11)。

很明显,我试图在网上查找有关该问题的信息,并从那时起采取了一些措施;

  • 在构建机上更新了Visual Studio。

  • 在构建定义中进行了更改,以使用“ VSTest平台安装程序”构建步骤(版本16.0.1),并在“测试组件”的构建步骤中使用“由工具安装程序安装”。

    < / li>
  • 将nuget软件包MSTest.TestAdapter和MSTest.TestFramework更新到最新版本(2.0.0 beta4)

  • vstest.console.exe是15.0.0版。

我很乐意提供更多信息或需要的信息...

编辑:

我实际上只能在发布模式下重现此问题,即使在发布模式下甚至在运行单个测试用例时,即使在Visual Studio中也可以重现此问题,这提示了我最初认为的其他错误区域。在本地运行测试用例时,不会向TFS服务器进行报告,因此还有其他问题。

1 个答案:

答案 0 :(得分:0)

内部测试代码似乎存在一个非常奇怪的问题,我们使用MSMQ来ping跟踪测试环境(系统测试)的代理,由于某些原因,对于某些情况,MSMQ发送会花费很长时间在发布模式下构建测试用例。如果有人因为正在寻找类似问题的答案而看到它,对不起,我什至不知道自己是什么实际问题。