General Feedback

Bug? Feature Request? Multiple processing threads should not use the same workspace.

Started by Magnus Lidbom on 6,834 views

Hi :)

I'm seeing failures when running multiple processing threads that I can only explain by assuming that multiple processing threads use the same workspace simultaneously.
Given that NCrunch uses multiple workspaces I would have assumed that this should not happen.
If only NCrunch did not do this, I could run multiple threads for all our tests. This would be very beneficial to the slow tests is question.


Hi, thanks for posting!

NCrunch can use the same workspace for multiple test runner processes, though it will never run multiple threads within the same process.

The problem with creating a new workspace for every test runner is that this means ALL projects within the solution need to be built multiple times, once for each test process. This is because NCrunch shadows only pre-built code and it relies on the build process to transform this code into an executable set of assemblies. The increase in build effort would likely outweigh the benefits you would receive from the parallel execution, as the build is quite resource intensive and involves a large amount of I/O activity.

If your tests don't support working in the same workspace at the same time, you can disable parallel execution for the solution to prevent them conflicting with one another. A better alternative would be to design the tests in such a way as to avoid them conflicting (i.e. if they are sharing the file system, make sure they randomise the names of any output files they use). You can also mark the tests using the ExclusivelyUsesAttribute to allow more granular concurrency constraints.

I hope this helps!


Cheers,

Remco

Post a reply

Log in to reply.