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

Notification

Icon
Error

dotnet.exe hosted by nCrunch.EngineHost462.x64.exe using 25% CPU doing nothing
slafave
#1 Posted : Friday, February 8, 2019 4:09:32 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2017(UTC)
Posts: 13
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
I have a solution with 158 tests. They are all passing, they all execute in milliseconds.

In the past week I noticed that NCrunch Engine was consuming 25% of my CPU time, even when I'm not doing anything in VS. NCrunch has nothing queued for execution, I'm not actively developing, all tests are in a passed state. If I disable NCrunch the CPU falls back to idle.

I have a screenshot of the NCrunch-hosted dotnet process consuming the 25% cpu, along with it's stack dump on one of the consuming threads. Looks like there is no way to attach it to this report?

Windows Version: Win 10 Pro, 1809, build 17763.292
Visual Studio 2017 version: 15.9.6
NCrunch Version: 3.23.0.10
.Net Core SDK: 2.2.103
.Net Core Runtime: 2.2.1

nCrunch.EngineHost462.x64.exe Command Line
"c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\remco software\ncrunch for visual studio 2017\nCrunch.EngineHost462.x64.exe" -1 nCrunch_c8dcaf5c72094941b2e1d1c0e91eddc8 9869e28716d04d218c7b80e61466c39c "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\remco software\ncrunch for visual studio 2017\nCrunch.Client.DLL" nCrunch.Client.EngineHosting.HostedEngine "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\remco software\ncrunch for visual studio 2017" "True" ""

hosted dotnet.exe Command Line
"C:\Program Files\dotnet\dotnet.exe" "C:\codeCaches\nc\12768\2\tests\Fl.KafkaMediator.Tests\bin\Debug\netcoreapp2.2\nCrunch.TaskRunner.DotNetCore.20.x64.dll" 12768 nCrunch_e333c438b5b5448cbc119f1a269eee0a 9b151416a01f438a9a677839e14dca41 "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\remco software\ncrunch for visual studio 2017\nCrunch.TestExecution.DotNetCore.dll" nCrunch.TestExecution.RemoteTaskRunner "C:\codeCaches\nc\12768\2\tests\Fl.KafkaMediator.Tests\bin\Debug\netcoreapp2.2" "False" "C:\codeCaches\nc\12768\2\tests\Fl.KafkaMediator.Tests\bin\Debug\netcoreapp2.2\Fl.KafkaMediator.Tests.dll.config.ncrunchconfig"


Remco
#2 Posted : Friday, February 8, 2019 11:03:25 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)
slafave;13051 wrote:
I have a solution with 158 tests. They are all passing, they all execute in milliseconds.

In the past week I noticed that NCrunch Engine was consuming 25% of my CPU time, even when I'm not doing anything in VS. NCrunch has nothing queued for execution, I'm not actively developing, all tests are in a passed state. If I disable NCrunch the CPU falls back to idle.

I have a screenshot of the NCrunch-hosted dotnet process consuming the 25% cpu, along with it's stack dump on one of the consuming threads. Looks like there is no way to attach it to this report?


Hi, thanks for sharing this problem. Off the bat, I'm not sure what could cause this. The stack trace of the running thread would definitely be illuminating if you're able to copy/paste it in here.

I wonder if the engine is responding to file system events. Does your Windows Task Manager show any files being accessed under the open solution directory?
slafave
#3 Posted : Friday, February 8, 2019 11:20:08 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2017(UTC)
Posts: 13
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
[img=https://1drv.ms/u/s!ApAvr87fXSU8gUYpYdiZGDus4MIO]stack dump[/img]

I'll have to check the file handles on Monday when I'm back online.
Remco
#4 Posted : Friday, February 8, 2019 11:24:58 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)
Thanks for the dump. Would it be possible for you to send through a 'Bug report' when the engine is 'Busying' itself? You'll need to do this when the engine has no work it's supposed to be doing, but is still chewing CPU. The bug report contains a log that should be very revealing.
slafave
#5 Posted : Tuesday, February 12, 2019 2:51:22 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2017(UTC)
Posts: 13
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
I sent the bug report just now. Hopefully it is helpful.

I also look at all the open file handles under the hosted dotnet.exe process. They appear to be the solution's compiled DLLs in the NCrunch cache, the Core 2.2 libs in the shared MS install location, and mu local NuGet cache. Nothing stood out to me.
slafave
#6 Posted : Tuesday, February 12, 2019 5:16:40 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2017(UTC)
Posts: 13
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
An additional observation to add.

When F5 Debugging, NCrunch is now hosting a second dotnet.exe host that is also consuming 25% CPU, for a total of 50% CPU consumption by NCrunch doing nothing. :)

I have uploaded a bug report while in the middle of F5 debugging. No code has been changed so no reason to run any tests at the moment. NCrunch is reporting that no tests are running or queued for execution.
slafave
#7 Posted : Tuesday, February 12, 2019 5:22:00 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2017(UTC)
Posts: 13
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
Additional observation: everytime I kick off another F5 debug run, NCrunch adds another hosted dotnet.exe that's consuming 25% CPU! I now have 3 hosted dotnet.exe's consuming 75% of my CPU.

I am uploading a bug report in this state now.
slafave
#8 Posted : Tuesday, February 12, 2019 5:31:47 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2017(UTC)
Posts: 13
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
Additional info: If I close the solution but leave VS open, all NCrunch and hosted dotnet.exe processes go away, and CPU usage falls back to idle. I will upload a bug report for this state as well.
Remco
#9 Posted : Tuesday, February 12, 2019 10:13:53 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)
Thanks for these extra details. Just to confirm, the only process pulling CPU here is dotnet.exe right? If so, this actually isn't an issue with the NCrunch engine.

dotnet.exe is a bootstrap process used by .NET Core to start the process that hosts user code. Neither NCrunch nor yourself will have any code hosted inside this process. It's entirely from MS, by MS, hosting only MS code from the .NET Core runtime.

So this looks like a bug in .NET Core. This might be related - https://stackoverflow.com/questions/50383015/dotnet-core-2-consuming-high-cpu.

There isn't really much I can do here other than to try and help you narrow down why this might be happening under NCrunch and not in other conditions in the hope of finding a workaround.

Are you able to produce this in a sample project/solution?

Are you able to surface this issue in any way outside of NCrunch? (i.e. console process or other test runner).
slafave
#10 Posted : Thursday, February 14, 2019 7:13:09 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2017(UTC)
Posts: 13
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
I have narrowed it down to a particular test suite. I'm enabling each test there one at a time to figure out which one causes the issue.
slafave
#11 Posted : Thursday, February 14, 2019 9:38:19 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/19/2017(UTC)
Posts: 13
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
Found it and you were right, not an NCrunch issue. Not even a DotNetCore issue. An ancient class buried deep in a series of mocks had a timer that activated a while loop that spun over an empty array to simulate polling a queue. :-(

Thanks for the help, sorry to bother you with our issues....
Remco
#12 Posted : Thursday, February 14, 2019 9:46:01 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)
slafave;13077 wrote:
Found it and you were right, not an NCrunch issue. Not even a DotNetCore issue. An ancient class buried deep in a series of mocks had a timer that activated a while loop that spun over an empty array to simulate polling a queue. :-(

Thanks for the help, sorry to bother you with our issues....


I'm glad you found this. Thanks for letting me know!
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.062 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download