Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Bug? Feature Request? Multiple processing threads should not use the same workspace.
Magnus Lidbom
#1 Posted : Thursday, August 30, 2012 10:39:55 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 8/30/2012(UTC)
Posts: 43

Thanks: 7 times
Was thanked: 7 time(s) in 7 post(s)
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.


Remco
#2 Posted : Thursday, August 30, 2012 11:43:08 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
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
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.024 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download