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

Notification

Icon
Error

Performance Issues with NCrunch v2.6
DamirArh
#1 Posted : Saturday, April 19, 2014 12:09:37 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/8/2014(UTC)
Posts: 9
Location: Slovenia

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Anybody else encountering any issues with the latest version of NCrunch?

During initialization of NCrunch Visual Studio starts eating up lots of memory (over 2.5 GB) and becomes unresponsive. This takes minutes and sometimes causes VS to even crash. The problem occurs before the tests are run (I set them all to be started manually). Even when it succeeds to initialize, the problem repeats whenever I change the code. It seems to me that it is caused during build. I tried deleting the cache, disabling and reenabling NCrunch, restarting Windows, but nothing helped.

After I uninstalled the latest version and installed NCrunch v2.5, the problems went away completely. During NCrunch initialization the Visual Studio memory footprint hardly changes. Visual Studio also remains responsive during code changes and general "crunching".
Remco
#2 Posted : Saturday, April 19, 2014 1:20:00 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 sharing this issue.

This definitely sounds like a very serious memory leak. It hasn't shown up in any of my immediate tests, so I suspect there may be something in your environment that triggers it or makes it more severe.

I'm wondering if you might be able to help by answering a few questions about how 2.6 behaves on your system. This will help narrow down the areas I need to look, and hopefully allow me to reproduce the issue so it can be fixed:

- When is the larger amount of memory consumed? Does this appear to happen when NCrunch is saying its loading your projects, or does it happen when physical builds are executing in the processing queue?
- Is there any difference in behaviour if you close ALL NCrunch tool windows?
- Do you notice this on just one solution, or every solution?
- On the primary solution you've been testing with, roughly how large is this solution in terms of lines-of-code, number of projects and number of tests?
- If you switch on NCrunch so that the memory is leaked, then disable it, is the allocated memory released? If you re-enable NCrunch, does the memory leak continue to stack?
DamirArh
#3 Posted : Sunday, April 20, 2014 8:36:30 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/8/2014(UTC)
Posts: 9
Location: Slovenia

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Today I updated NCrunch to V2.6 again, but I couldn't reproduce the above described issue, no matter how hard I tried, neither with the solution I worked on yesterday (even if I reverted it to the same state), nor with any of my other solutions I used NCrunch with in the past.

I plan to continue development on that same solution most of the day tomorrow and I'll definitely let you know if the issue reappears.

Sorry for the false alert, as it currently seems, but it really seemed connected to the new release of NCrunch, since I haven't changed anything else on my machine recently, including since yesterday's issues.
Remco
#4 Posted : Sunday, April 20, 2014 9:03:29 AM(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 updating me on this. After your post, I went into a bit of a mad panic, which I often do for serious bug reports straight after a release, attempting to compare profiling runs of NCrunch 2.5 against 2.6.

The conclusions I came up with were:
- v2.6 memory usage seemed to be slightly lower than v2.5, this is likely due to the memory traffic optimisations that have been newly introduced
- v2.6 still allocates more memory than I would like it to, but seems to stay within acceptable boundaries for use on large solutions with dense code coverage
- Something must have happened in your environment to trigger the memory consumption, and we don't yet know what it was!

Do let me know if you manage to pin down a pattern that can reproduce the problem. The VS IDE can often be a challenging environment to track memory utilisation in, as there are so many different packages (often from different vendors) competing for the same resources. If you have any other complex VS packages installed (i.e. refactoring tools, VCS integration, etc), it may be worth turning them off/on to see if this helps with narrowing things down.
DamirArh
#5 Posted : Monday, April 21, 2014 8:16:01 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/8/2014(UTC)
Posts: 9
Location: Slovenia

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I managed to reproduce the issue again. It seems to be related to the NCrunch Tests window. The huge memory consumption only occurs when this window is visible and has a width below cca. 700 pixels. It happens even if I don't change the code at all, but only make the window narrower. Once NCrunch manages to render it again, the memory footprint and CPU usage get down again, but increase as soon as I change something in the code. I can't test this for long because in a few attempts at maximum, Visual Studio crashes.

I have now reorganized my windows a bit to keep NCrunch Tests window wider and avoid the issue. I'll continue working like that for the rest of the day and let you know if the issue still comes up.

On an unrelated note: in the previous version compilation errors were displayed in the bottom pane of NCrunch Tests window when the project with the failed build was selected in the list above. In the latest version the bottom pane remains empty if this is the case. Is this a feature or a bug?
Remco
#6 Posted : Monday, April 21, 2014 8:29:36 AM(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)
Still no luck in getting it to happen here. Does it happen when you resize the window? Or just when you keep it open? Does there seem to be any pattern around the selection in the tests window (i.e. if you have a test selected with lots of trace output or not)? What happens if you try turning off all the filters so that there is no data showing in the tree?

NCrunch should usually report build errors in the Tests window, if any are available. Looking up the failed build in the processing queue may give you more information. This sounds like it could be a bug, and may even be related to the memory problem you're experiencing. Would you be able to try turning on the 'Log to output window' global configuration setting? I wonder if exceptions are being thrown by NCrunch when you're working in the Tests window. If this is the case, turning on this setting should allow them to be reported in NCrunch/VS's output window.
DamirArh
#7 Posted : Monday, April 21, 2014 9:13:56 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/8/2014(UTC)
Posts: 9
Location: Slovenia

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
It happens, when I resize the window below a certain width. If I keep it open like that it seems to be happening every time, the window is being re-rendered. I followed your advice and turned off all the filters, so that there was nothing in the list; it didn't happen then.

I also enabled logging to Output window. Every time the memory consumption spiked, there was an OutOfMemoryException logged in the Output window, unless Visual Studio crashed. Here are two of them:

[10:53:16.5355-UI-1] ERROR (Internal): System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Collections.Generic.LinkedList`1.AddAfter(LinkedListNode`1 node, T value)
at NCrunch.VSAddIn.UI.TextDisplayControl.SplitTextContent..ctor(String content, Int32 maxLineLength, IList`1 hyperlinks)
at NCrunch.VSAddIn.UI.TextDisplayControl.TextDisplay.#=qGSGTWkQNY2kpk80EcsPwNpD24mCxC49a98wrR3IR8mE=()
at NCrunch.VSAddIn.UI.TextDisplayControl.TextDisplay.#=qGn0Nyw$MZfgpGdRkg_$P3Q==()
at nCrunch.Common.ErrorHandler.DoWithErrorHandling(Action action, Object context)

[11:01:26.5325-UI-1] ERROR (Internal): System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Collections.Generic.LinkedList`1.AddAfter(LinkedListNode`1 node, T value)
at NCrunch.VSAddIn.UI.TextDisplayControl.SplitTextContent..ctor(String content, Int32 maxLineLength, IList`1 hyperlinks)
at NCrunch.VSAddIn.UI.TextDisplayControl.TextDisplay.#=qGSGTWkQNY2kpk80EcsPwNpD24mCxC49a98wrR3IR8mE=()
at NCrunch.VSAddIn.UI.TextDisplayControl.TextDisplay.SetContent(String content, IList`1 hyperlinks)
at nCrunch.VSAddIn.UI.TestTree.LinkedOutputText.ApplyToTextDisplay(TextDisplay textDisplay)
at nCrunch.VSAddIn.UI.TestTree.TestsWindow.#=q1jsKORUTV365ycPrrX_UpWGVN_lGVMpwm3od7OdPDVE=()
at nCrunch.VSAddIn.UI.TestTree.TestsWindow.#=qyTUshAyxncThR5sVu_CfUvZSa0jDRO5GkqDI8KFXyoU=()
at nCrunch.VSAddIn.UI.TestTree.TestsWindow.#=qXh4RBEdbhNe$xdZXbUrMWyheqCowogzjwwMxRyM6I_s=(Action #=q2vPU17HO5WTRRANNRxBmaw==)

Strangely enough, the window still seemed to be properly rendered after this exception.

Regarding the build errors: they are logged to the output window and they are displayed in the Processing Queue window. They just don't show up in the NCrunch Tests window. but there are no exceptions logged when I have it open wide enough and build errors are being logged. Could I somehow turned that off? It's not that much of a problem though, since build errors are listed in Visual Studio's Error List window anyway.
Remco
#8 Posted : Monday, April 21, 2014 11:28:41 AM(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)
These exceptions are very interesting. They are being thrown from a routine responsible for 'slicing' the text in the Tests Window text output pane, so that the text fits in the pane horizontally. When the pane is made less wide, the routine is much less efficient as there is less space to fit the text.

This would suggest that the memory consumption problem is being caused by NCrunch trying to show large amounts of text. Do you have any tests or builds that output vast amounts of data to trace/console?

NCrunch should normally display the build errors for projects that fail to build with its own build engine. It won't show build errors that come from foreground builds (i.e. if you build using VS). If you have NCrunch reporting that a project is failing to build, and you click on it, and there's no build errors displaying in the Tests Window output pane, then that's a bug. Considering no one else has reported it, the occurrence of such a bug may be related to this out-of-memory problem. If you are seeing this, does it happen on a small dummy solution created from one of the VS project templates?

Also .. Do you have the Tests Window set up to show the text output on the right side of the window, or on the bottom? (split button on toolbar)
DamirArh
#9 Posted : Monday, April 21, 2014 1:13:46 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/8/2014(UTC)
Posts: 9
Location: Slovenia

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I created a new solution from the unit test template in VS which only includes a single empty unit test. The problem was still there.

In the meantime I noticed that the Test window text output pane never displays any text (even with large enough width): not only there's no build errors, there are also no test failures or console output. The same goes for the empty test solution I created from the template.

I usually have the text ouput pane at the bottom, but it makes no difference if I put it on the right. As soon as it (not the whole Tests windows) gets below a certain width, the memory spikes occur.

I also tried installing the latest version of NCrunch on my laptop. At first it seemed to work ok (displayed text in output pane as expected, even with the window being really narrow). I then tried connecting the laptop to a second screen and the issue started occuring there as well. It might not be directly related to that, since I now have the same issue on my laptop as well, even when it is not connected to an external display.
VNicholson
#10 Posted : Monday, April 21, 2014 9:48:23 PM(UTC)
Rank: Member

Groups: Registered
Joined: 12/19/2013(UTC)
Posts: 25
Location: New Zealand

Thanks: 7 times
Was thanked: 3 time(s) in 3 post(s)
I observed this same problem after upgrading to 2.6 and had to revert to 2.5. NCrunch appeared to be behaving fine until I tried to activate the 'NCrunch Tests' window at which point Visual Studio appeared to hang, consume a lot of memory and then crash. If there are any logs I can enable to help you diagnose this further, please let me know.

I have one project in particular that can reproduce the problem every time with Visual Studio 2013.

* I open my project and enable NCrunch.
* I activate the NCrunch Tests window (it's fine at this point and the pane is split vertically).
* I switch to a horizontal split (still fine).
* I resize the splitter so that most of the window is dedicated to the tests list, not the test output (when I release the mouse after resizing the splitter, Visual Studio memory usage goes through the roof).

When the Visual Studio window starts responding again, I see the error below in the output window:

[10:06:34.0894-LocalBuildTask-62] ERROR (Build): MyProject: C:\Users\bob\AppData\Local\NCrunch\10436\3\Framework\MyProject\Whatever.cs (12): Der Typ- oder Namespacename 'PubSubEvents' ist im Namespace 'Microsoft.Practices.Prism' nicht vorhanden. (Fehlt ein Assemblyverweis?)

[10:07:24.0524-UI-1] ERROR (Internal): System.OutOfMemoryException: Eine Ausnahme vom Typ "System.OutOfMemoryException" wurde ausgelöst.
bei System.Collections.Generic.LinkedList`1.AddAfter(LinkedListNode`1 node, T value)
bei NCrunch.VSAddIn.UI.TextDisplayControl.SplitTextContent..ctor(String content, Int32 maxLineLength, IList`1 hyperlinks)
bei NCrunch.VSAddIn.UI.TextDisplayControl.TextDisplay.#=qGSGTWkQNY2kpk80EcsPwNpD24mCxC49a98wrR3IR8mE=()
bei NCrunch.VSAddIn.UI.TextDisplayControl.TextDisplay.#=qGn0Nyw$MZfgpGdRkg_$P3Q==()
bei nCrunch.Common.ErrorHandler.DoWithErrorHandling(Action action, Object context)
Remco
#11 Posted : Monday, April 21, 2014 10:14:05 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)
Right, I wonder if this is related to the new font setting that was introduced in 2.6.

Can you let me know what the 'Text output font' is set to under your global configuration? And whether changing it makes any difference?

Also, are you running in standard DPI?
VNicholson
#12 Posted : Monday, April 21, 2014 10:26:30 PM(UTC)
Rank: Member

Groups: Registered
Joined: 12/19/2013(UTC)
Posts: 25
Location: New Zealand

Thanks: 7 times
Was thanked: 3 time(s) in 3 post(s)
Remco;5743 wrote:
Can you let me know what the 'Text output font' is set to under your global configuration? And whether changing it makes any difference?

You might be on to something there. My OS is running in German and the font size was "Courier New, 825". Changing this to 8 seems to have fixed the problem. German uses a comma decimal separator which might have something to do with the problem (the location for DamirArh is listed as Slovenia which also uses a comma separator according to Google).

Remco;5743 wrote:
Also, are you running in standard DPI?

Yep, standard DPI.
Remco
#13 Posted : Monday, April 21, 2014 11:24:10 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)
Gotcha. That will be it then. NCrunch is reading the font size from the config file using the current culture, and storing it using the invariant culture. It seems that 8.25 returns 825 when read with a different culture. This messes with the text output slicing causing the text pane to gobble insane amounts of memory. The high font size will also make all text in this window invisible.

I'm preparing a fix now for this issue. It's very serious so I will release it as 2.7. Sorry for the trouble, I'll update the download page soon.
Remco
#14 Posted : Tuesday, April 22, 2014 1:38:27 AM(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)
A fix for this is now available in the 2.7 release. As described above, changing the font size to a value without a decimal will also work around this problem.
VNicholson
#15 Posted : Tuesday, April 22, 2014 1:49:33 AM(UTC)
Rank: Member

Groups: Registered
Joined: 12/19/2013(UTC)
Posts: 25
Location: New Zealand

Thanks: 7 times
Was thanked: 3 time(s) in 3 post(s)
Remco wrote:
A fix for this is now available in the 2.7 release. As described above, changing the font size to a value without a decimal will also work around this problem.

I purged all of my NCrunch configuration files and repeated the original replication steps and everything is working perfectly now. Thanks for the quick turn around.
DamirArh
#16 Posted : Tuesday, April 22, 2014 4:49:20 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/8/2014(UTC)
Posts: 9
Location: Slovenia

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I can confirm that 2.7 resolves the issue. I had to manually set the correct font size after update, though. It was still set to 825.
Remco
#17 Posted : Tuesday, April 22, 2014 5:00:12 AM(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 confirmation. I've updated 2.7 with a minor build (2.7.0.3) that contains a change to automatically reset the font size if it's higher than 600. This should correct the issue for unsuspecting users.
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.106 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download