-
Notifications
You must be signed in to change notification settings - Fork 730
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
When an assembly is marked with ParallelScope.None and there are Parallelizable tests Nunit hangs #2261
Comments
This may be related also. If I change the tests to be Fixture level with having None on the Assembly the tests do not hang and return a result but my Resharper test runner is telling me that
|
It looks like WorkItemQueue is restored to an empty queue after the parallel work items have been queued so they are lost. This causes nunit to get stuck in ParallelWorkItemDIspatcher.OnEndOfShift since State is not Complete but there are no shifts to start since all queues are empty. |
The problem is that the queue state is restored without having previously been saved. It happens because we save the queue when the test worker becomes busy after dequeuing a non-parallel item. In this case, it encounters a non-parallel item while runnng a higher-level non-parallel item and so runs it directly on the same thread, without enqueuing / dequeuing anything. |
Workaround in this case is to eliminate use of |
Notes toward a solution...
@nunit/framework-team Any thoughts on the above would be useful as I move ahead. |
@CharliePoole, you know the code better than me, but removing the optimization in step 4 seems to be the conceptually correct fix. Option 7 adds additional complexity. The optimization seems reasonable and I would have probably done the same thing, but it feels like it disconnects those test runs from the rest of the system. Do we have any numbers on the increase in test time for queuing non-p test fixtures rather than running them on the same thread? |
I wish we did have some numbers. I've observed improvements, but it's anecdotal and also, I believe, masked by the Sleep(1) issue that is discussed elsewhere. I'd like to see a set of integration tests, completely separate from our unit tests, which ran a bunch of assemblies with instrumentation. |
I think the same as @rprouse.
Maybe we should track this with an issue and add to it each time we think of another scenario where we need integration tests? |
Using the following
in a class library targetting .NET Framework 4.5.2
If I include
[assembly: Parallelizable(ParallelScope.None)]
in my AssemblyInfo.cs file and then have tests like the following
The test runner hangs and will not return, as soon as I remove the assembly attribute the tests run fine.
Repro solution here https://ufile.io/1zbgk
The text was updated successfully, but these errors were encountered: