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

Notification

Icon
Error

NCrunch console tool kills msbuild process
dvircohen
#1 Posted : Sunday, April 29, 2018 11:07:59 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2018(UTC)
Posts: 8
Location: Israel

Was thanked: 1 time(s) in 1 post(s)
Hi,

We followed the instructions here for running the console tool in our TFS build server:
https://www.ncrunch.net/...ides_console-tool-usage

We had some licence problems and other stuff, currently when everything should work, the build fails and we get:
Exception Message: MSBuild error 3 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

We couldn't find any log or some message that can help us here.

Thanks.
michaelkroes
#2 Posted : Sunday, April 29, 2018 11:23:58 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Hi thanks for posting!

Does the console tool work when you execute it from the command line with the same parameters/account/machine as when you run it from tfs?
dvircohen
#3 Posted : Sunday, April 29, 2018 11:55:31 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2018(UTC)
Posts: 8
Location: Israel

Was thanked: 1 time(s) in 1 post(s)
That's exactly what i did after uploading the post..

Probably it didn't have the configuration and also the NCrunchCacheStoragePath variable..
So i put the config file in some absolute path and run it from the command line and now it works..

Now how can i pass the config file path to the tfs ncrunch task? I've tried to look into the Ncrunch.Console.targets and i have there the next lines:
<Target Name="ExecuteNCrunch">
<NCrunchTask SolutionDir="$(SolutionDir)" SolutionName="$(SolutionName)" OutDir="$(OutDir)\NCrunchResults" />
</Target>

Maybe there is another flag for config? or maybe i can pass it from the csproj file?
dvircohen
#4 Posted : Sunday, April 29, 2018 1:34:56 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2018(UTC)
Posts: 8
Location: Israel

Was thanked: 1 time(s) in 1 post(s)
Another thing, i took the config file from my PC - where the tests are flying - and put it on the build server.
This is my conf file:
<GlobalConfiguration>
<Settings>
<CPUCoresAssignedToNCrunch>0,1,2,3,4,5,6,7,8,9,10,11,12,13</CPUCoresAssignedToNCrunch>
<CPUCoresAssignedToVisualStudio>14,15,16,17,18,19,20,21,22,23,24,25,26,27</CPUCoresAssignedToVisualStudio>
<FastLaneThreads>1</FastLaneThreads>
<MaxNumberOfProcessingThreads>14</MaxNumberOfProcessingThreads>
<MaxTestRunnerProcessesToPool>1</MaxTestRunnerProcessesToPool>
<SystemConfigured>True</SystemConfigured>
<TerminateTestRunnerTasksOnExecutionComplete>False</TerminateTestRunnerTasksOnExecutionComplete>
<UseSimplifiedSettingsWhereAvailable>True</UseSimplifiedSettingsWhereAvailable>
<WizardAllowParallelTestExecution>True</WizardAllowParallelTestExecution>
<WizardEngineMode>Run all tests automatically</WizardEngineMode>
<WizardIgnoreTests>False</WizardIgnoreTests>
</Settings>
<EngineModes>
<EngineMode>
<Name>Run all tests automatically</Name>
<Settings />
</EngineMode>
<EngineMode>
<Name>Run all tests manually</Name>
<Settings>
<TestsToExecuteAutomatically>False</TestsToExecuteAutomatically>
</Settings>
</EngineMode>
<EngineMode>
<Name>Run impacted tests automatically, others manually</Name>
<Settings>
<AlignOutOfDateStatusWithImpactStatus>True</AlignOutOfDateStatusWithImpactStatus>
<TestsToExecuteAutomatically>IsImpacted</TestsToExecuteAutomatically>
</Settings>
</EngineMode>
<EngineMode>
<Name>Run pinned tests automatically, others manually</Name>
<Settings>
<AutoPinNewTests>True</AutoPinNewTests>
<TestsToExecuteAutomatically>IsPinned</TestsToExecuteAutomatically>
</Settings>
</EngineMode>
</EngineModes>
</GlobalConfiguration>

i also tried to change the FastLaneThreads to 0, MaxTestRunnerProcessesToPool to 10 and remove the CPUCoresAssignedToNCrunch & CPUCoresAssignedToVisualStudio.
i see that i have only one or two TestHost processes that are working - all the rest are with CPU 0, whereas on my computer i have about 14 or 15 that are working hard.
michaelkroes
#5 Posted : Sunday, April 29, 2018 2:03:55 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
In the NCrunchTask you can use the parameter ConfigFile to specify the path to the configuration file.

In the config file the CPU cores options are ignored (as are a lot of other settings).
dvircohen
#6 Posted : Monday, April 30, 2018 7:22:40 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2018(UTC)
Posts: 8
Location: Israel

Was thanked: 1 time(s) in 1 post(s)
Thanks, it is working now and the TFS Build are using the NCrunch.
But, it takes really long time. Again, it uses maximum of 2 or 3 processes of the TestHost and all other look like idle.
It is the same if i running it from the command line.
If i'm taking this configuration and run it from the command line in my machine it uses all process and finishes really fast.
This is the configuration file currently:
<GlobalConfiguration>
<Settings>
<FastLaneThreads>0</FastLaneThreads>
<MaxNumberOfProcessingThreads>20</MaxNumberOfProcessingThreads>
<MaxTestRunnerProcessesToPool>10</MaxTestRunnerProcessesToPool>
<SystemConfigured>True</SystemConfigured>
<TerminateTestRunnerTasksOnExecutionComplete>True</TerminateTestRunnerTasksOnExecutionComplete>
<UseSimplifiedSettingsWhereAvailable>True</UseSimplifiedSettingsWhereAvailable>
<WizardAllowParallelTestExecution>True</WizardAllowParallelTestExecution>
<WizardEngineMode>Run all tests automatically</WizardEngineMode>
<WizardIgnoreTests>False</WizardIgnoreTests>
<NCrunchCacheStoragePath>C:\Builds\NCrcunch Cache</NCrunchCacheStoragePath>
</Settings>
<EngineModes>
<EngineMode>
<Name>Run all tests automatically</Name>
<Settings />
</EngineMode>
<EngineMode>
<Name>Run all tests manually</Name>
<Settings>
<TestsToExecuteAutomatically>False</TestsToExecuteAutomatically>
</Settings>
</EngineMode>
<EngineMode>
<Name>Run impacted tests automatically, others manually</Name>
<Settings>
<AlignOutOfDateStatusWithImpactStatus>True</AlignOutOfDateStatusWithImpactStatus>
<TestsToExecuteAutomatically>IsImpacted</TestsToExecuteAutomatically>
</Settings>
</EngineMode>
<EngineMode>
<Name>Run pinned tests automatically, others manually</Name>
<Settings>
<AutoPinNewTests>True</AutoPinNewTests>
<TestsToExecuteAutomatically>IsPinned</TestsToExecuteAutomatically>
</Settings>
</EngineMode>
</EngineModes>
</GlobalConfiguration>

My machine is 28 cores, 32GB ram, win8.1 64 bit
and the build server is 40 cores, 128 GB and win server 2012 64 bit (it should be stronger than my machine)
michaelkroes
#7 Posted : Monday, April 30, 2018 7:44:55 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Could you have a look at the log of the run? In the first section of that log we dump all the settings the console tools is using for this run. We are curious about the AllowParallelTestExecution setting. Maybe it's getting overwritten somewhere.
dvircohen
#8 Posted : Monday, April 30, 2018 7:59:46 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2018(UTC)
Posts: 8
Location: Israel

Was thanked: 1 time(s) in 1 post(s)
I forgot to check in the file "FusionClient.v3.ncrunchsolution" that contains this parameter:
<AllowParallelTestExecution>True</AllowParallelTestExecution>

Now it works and finishes in 3.8 minutes instead of 24 minutes (!!!)

Thanks for the support!
1 user thanked dvircohen for this useful post.
michaelkroes on 4/30/2018(UTC)
michaelkroes
#9 Posted : Monday, April 30, 2018 8:01:32 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Great to hear! Glad we could help.
dvircohen
#10 Posted : Monday, April 30, 2018 12:29:56 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2018(UTC)
Posts: 8
Location: Israel

Was thanked: 1 time(s) in 1 post(s)
I have some problem still..
If i run 2 builds on parallel, for example if 2 developers check in their code, so i get timeout exception from that more longer tests..usually it will be integration tests.
I increased the timeout for these projectsto 120 seconds instead of 60..it helps but there are still tests that are failing.

Maybe i can tell the ncrunch to not start some tests unless it is more free to run?
michaelkroes
#11 Posted : Monday, April 30, 2018 1:05:21 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
Probably the easiest way to handle that is to install a gridnode on the build server (You can use your normal license), then configure the console runner to use the gridnode and not run any tests itself.

You can add this to the configuration for the console tool:

<DisabledNodes>
<Value>(local):0</Value>
</DisabledNodes>

<GridServerReferencesForComputer>
<Value>SERVERNAME&gt;HASHED password</Value>
</GridServerReferencesForComputer>

The grid server reference is probably easiest to configure in VS and just copy that setting over to the console tool.

As an added benefit you can use the capacity on your dev box too. The gridnode shares its capacity across all clients equally.
dvircohen
#12 Posted : Tuesday, May 1, 2018 9:23:05 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2018(UTC)
Posts: 8
Location: Israel

Was thanked: 1 time(s) in 1 post(s)
i didn't understand fully how this should help to the issue..?
michaelkroes
#13 Posted : Tuesday, May 1, 2018 9:26:39 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 277
Location: Netherlands

Thanks: 122 times
Was thanked: 62 time(s) in 59 post(s)
If you use the console tool and run it twice simultaneously both instances will compete for resources. If you install the grid node on the build server that will run as a service. The console tool will contact the grid node and ask it to build/run the tasks. The grid node will share its capacity between the connected clients.
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.074 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download