-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cancelling a test session may lead to a block #4527
Comments
I tried to repro, but it never was hanging for me. I know that I've been doing some fixes in that code some time ago, so maybe it is fixed. This is the easiest wayt to try to reproduce probably: main...nohwnd:vstest:cancel-run (And then just run the Playground project). Does it repro for you? |
Hi |
I removed the work around and used Stryker against a large and complex project that was likely to exhibit the issue. |
Perfect, thanks for confirming. |
Description
Running a test session with multiple test sources with parallelism disabled will lead to a blocked/hanged VsTest if the session is cancelled once the first sub session is completed.
Steps to reproduce
Note that is has been reproduced while working on Stryker.Net; note sure how to replicate via command line.
Start a VsTest session (via
IVsTestConsoleWrapper.RunTestsWithCustomTestHost(...)
) with two test assemblyies.Cancel the test session (via
IVsTestConsoleWrapper.CancelTestRun
) after all test in the first assembly have been executed.Expected behavior
TestRunComplete
event should be triggered.Session should stop as soon as possible.
Actual behavior
No
TestRunComplete
event is raised and session will hang or timeout (if a timeout has been set).Diagnostic logs
Here are the parameters:
(TestExecution.GetTestRunnerProcessStartInfoForRunAll) -> {"Version":7,"MessageType":"TestExecution.GetTestRunnerProcessStartInfoForRunAll","Payload":{"Sources":["C:\\Users\\cyrilledupuydauby\\source\\repos\\stryker-net\\integrationtest\\TargetProjects\\NetCoreTestProject.NUnit\\bin\\Debug\\net6\\NetCoreTestProject.NUnit.dll","C:\\Users\\cyrilledupuydauby\\source\\repos\\stryker-net\\integrationtest\\TargetProjects\\NetCoreTestProject.XUnit\\bin\\Debug\\net6\\NetCoreTestProject.XUnit.dll"],"TestCases":null,"RunSettings":"<RunSettings>\r\n<RunConfiguration>\r\n <CollectSourceInformation>false</CollectSourceInformation>\r\n <MaxCpuCount>1</MaxCpuCount>\r\n<CollectDataForEachTestSeparately>true</CollectDataForEachTestSeparately><DisableParallelization>true</DisableParallelization>\r\n<DesignMode>false</DesignMode>\r\n</RunConfiguration>\r\n</RunSettings>","KeepAlive":false,"DebuggingEnabled":false,"TestPlatformOptions":{"TestCaseFilter":null,"FilterOptions":null,"CollectMetrics":false,"SkipDefaultAdapters":false},"TestSessionInfo":null}}
Log extract (focus on what appear to be relevant):
Complete log file
Runner 2-log.txt
Environment
Windows 11 (running with Parallel Desktop on Mac OS 13.5
VsTest 17.6.1
VisualStudio 17.6.2
Further details:
Looking VsTest sources (more specifically
Microsoft.VisualStudio.TestPlatform.CrossPlatEngine
) it looks like the problem lies within 'ParallelProxyExecutionManager.HandlePartialRunComplete'the stopping condition
runCompletedClients == _runStartedClients
does not make sense for me.because
_runStartedClient
appears to be the number of concurrent test sessions (so matching concurrency settings), while_runCompletedClients
is the number of test sessions completed so far. I am guessing that the stopping condition for cancellation is making sure there is no longer any active session.Hope this helps
The text was updated successfully, but these errors were encountered: