Azure-pipelines-tasks: "VS Test" task hangs after the tests execution in release definition

Created on 10 Oct 2017  Â·  11Comments  Â·  Source: microsoft/azure-pipelines-tasks

Environment

  • VSTS: (I will provide the needed information _on demand_)
  • Agent

    • Private

    • OS: Windows_NT (10.0.14393)

    • Version: 2.123.0

Issue Description

When I run functional tests with the Visual Studio Test task, it is unable to finish and hangs indefinitely if I don't set a timeout (currently 2 minutes), even if I receive the usual test summary:

2017-10-10T18:45:32.7372445Z Results File: c:\1\r2\a\TestResults\montybuilduser_monty-bld 2017-10-10 18_44_57.trx
2017-10-10T18:45:32.7392447Z 
2017-10-10T18:45:32.7392447Z Total tests: 7. Passed: 4. Failed: 3. Skipped: 0.
2017-10-10T18:45:32.7392447Z Test Run Failed.
2017-10-10T18:45:32.7392447Z Test execution time: 49.4539 Seconds

Notes:

  • I'm running my tests with the TestAdapterPath set to "." to be able to run the tests with xUnit.
  • The tests are run by using Google Chrome in headless mode (Chrome is installed/updated through chocolatey on the private agent in the release definition).

Error logs

I don't have any error logs when the final summary shows up 😞

Test

Most helpful comment

you can close WebDriver instance and Dispose it off

Webdriver.Close()
Webdriver.Dispose()

All 11 comments

Quick update: Even if all the tests pass, the task is unable to finish properly and I've set a temporary timeout of 2 minutes to let the process continue afterwards.

@felpel Sorry for responding late to this thread.

Can you please add variable system.debug = true and share the build logs that gets generated. You can email us the logs at devops_tools[at]microsoft[dot]com.

Also if you try to run these tests manually from command line using vstest.console.exe, does the run completes and process exits?

@vimegh I tried to send you an email with the logs to the one you've provided, but it seems that I'm unauthorized.

For your other question, if I run the tests locally with the same command, the tests are not hanging.

@felpel We have received your email, we will respond you over email, and later will update the findings here.

This problem was resolved as felpel detected that project uses Chrome Driver’s processes in order to interact with Google Chrome for UI tests, and these processes were not exiting after the test were run. Steps were added to stop these blocking processes as cleanup, after which vstest didn't hang.

And which are these set of steps to close processes? Im facing the same issue.

Same here. Would @vimegh or @felpel explain the steps needed to close ChromeDriver?

you can close WebDriver instance and Dispose it off

Webdriver.Close()
Webdriver.Dispose()

Same problem here. Not using ChromeDriver in my project. All tests pass, the test report is written, but the task hangs. Is there any way to debug which other processes might possibly not be properly closing down?

I am running into same problem. The test sometimes is hung after all test have run, sometimes it hangs in the middle of run. I am running unit using vstest. the diagnostics also does not give any info on what may be causing tests to hang.

I have same problem。
This is normal log for vs test:
2019-10-16T06:41:26.7965043Z ##[debug]TestHostStop.Run : TestHost stop completed.
2019-10-16T06:41:26.7966830Z ##[debug]ExecutionStateResolver.SetNextPhase : Execution State Resolver called. Curren Phase: TestHostEnd
2019-10-16T06:41:26.7967532Z ##[debug]ExecutionStateResolver.SetNextPhase: TestExecutionHost.exe successfully exited with code 0
2019-10-16T06:41:26.7968156Z ##[debug]ExecutionStateResolver.SetNextPhase : Execution State Resolver exiting. Next Phase: None
2019-10-16T06:41:26.7969683Z ##[debug]* DTA Execution Engine Exited *
2019-10-16T06:41:26.7972685Z ##########################################################################
2019-10-16T06:41:26.8349411Z ##[debug]rc:0
2019-10-16T06:41:26.8350228Z ##[debug]success:true
2019-10-16T06:41:26.8360436Z ##[debug]Modules/DTAExecutionHost.exe exited
2019-10-16T06:41:26.8363177Z ##[debug]Agent.Version=2.131.0
2019-10-16T06:41:26.8364050Z ##[debug]Release.ReleaseUri=vstfs:///ReleaseManagement/Release/6157
2019-10-16T06:41:26.8370392Z ##[debug]Release.ReleaseId=6157
2019-10-16T06:41:26.8370987Z ##[debug]Build.BuildUri=vstfs:///Build/Build/1348
2019-10-16T06:41:26.8371474Z ##[debug]Build.Buildid=1348
2019-10-16T06:41:26.8371932Z ##[debug]Agent.Version=2.131.0
2019-10-16T06:41:26.8372770Z ##[debug]telemetry area: TestExecution feature: TestExecutionTask data: {"releaseuri":"vstfs:///ReleaseManagement/Release/6157","releaseid":"6157","builduri":"vstfs:///Build/Build/1348","buildid":"1348","agentFailure":false}
2019-10-16T06:41:26.8844488Z ##[debug]Processed: ##vso[telemetry.publish area=TestExecution;feature=TestExecutionTask;]{"releaseuri":"vstfs:///ReleaseManagement/Release/6157","releaseid":"6157","builduri":"vstfs:///Build/Build/1348","buildid":"1348","agentFailure":false}
2019-10-16T06:41:26.8845395Z ##[debug]DtaExecutionHost finished
2019-10-16T06:41:26.8845870Z ##[debug]Modules/DTAExecutionHost.exe exited
2019-10-16T06:41:26.8846383Z ##[debug]task result: Succeeded
2019-10-16T06:41:26.8868700Z ##[debug]Processed: ##vso[task.complete result=Succeeded;]Task succeeded

This is unnormal log task:
2019-10-17T01:07:49.5813748Z ##[debug]TestHostStop.Run : TestHost stop completed.
2019-10-17T01:07:49.5817862Z ##[debug]ExecutionStateResolver.SetNextPhase : Execution State Resolver called. Curren Phase: TestHostEnd
2019-10-17T01:07:49.5818567Z ##[debug]ExecutionStateResolver.SetNextPhase: TestExecutionHost.exe successfully exited with code 0
2019-10-17T01:07:49.5819162Z ##[debug]ExecutionStateResolver.SetNextPhase : Execution State Resolver exiting. Next Phase: None
2019-10-17T01:07:49.5820778Z ##[debug]* DTA Execution Engine Exited *

Was this page helpful?
0 / 5 - 0 ratings