NUnit runner crashes when test gives StackOverflowException

Bug #1083821 reported by Nicholas Devenish
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nunit-console
Triaged
Low
Unassigned

Bug Description

Made a brand new test project, and in the default TestMethod1 method:

    [Test]
    public void TestMethod1()
    {
      TestMethod1();
    }

The runner application gives "NUnit-Agent has stopped working", and then the main GUI crashes out when anything else is done with it. The runner reports 2.6.2.12296 as it's version.

Tags: crash runner
Revision history for this message
Simone Busoli (simone.busoli) wrote :

It's generally not possible to catch this exception in .NET.

See http://stackoverflow.com/questions/1599219/c-sharp-catch-a-stack-overflow-exception

Changed in nunitv2:
status: New → Invalid
Revision history for this message
Nicholas Devenish (ndevenish) wrote :

Right, so why does the Runner GUI crash? Aren't the actual tests run in separate process?

At the very least, it should be able to tell which test it was running when it crashed, and I wouldn't expect the test runner window to die (which, indeed, it doesn't - but seems to get very, very confused that the actual runner died).

Revision history for this message
Simone Busoli (simone.busoli) wrote :

I've tried to reproduce it with both the GUI and the console and I actually get a different outcome than what you described. None of them crashes but the agent process' death is causing some confusion indeed, and I don't even get a stackoverflow if the test assembly is compiled with optimizations. I didn't inspect the IL but I guess the compiler is transforming the recursive call into a loop.

Regardless, I'm not sure it's really worth handling this case though, it sounds like a quite uncommon scenario.

Revision history for this message
Nicholas Devenish (ndevenish) wrote :

*shrug*, Your call, I guess, it just seems bad (and not 'invalid', even if it is low priority) for a tool specifically to find errors in the tests, to crash when the tests don't pass.

Revision history for this message
Charlie Poole (charlie.poole) wrote :

I didn't see anybody mark the bug as 'invalid'. I'm calling it low priority.

Specifically, it seems to me that the bug would be the Gui crashing, not the agent. We can't really stop the agent from crashing in this situation, so long as NUnit remains a purely managed application.

Charlie

Changed in nunitv2:
status: Invalid → Triaged
importance: Undecided → Low
Revision history for this message
Simone Busoli (simone.busoli) wrote :

I marked the issue as invalid initially, which is what it looked like and I'm not yet sure about the validity for as I said, I couldn't reproduce it.

Nicholas, SOEs is not really what the tool is supposed to discover though, but I concur that a more proper handling, if any is possible, would be nice.
If you have a repro that you can submit please do so, as I mentioned I wasn't able to crash the GUI nor the console.

Revision history for this message
Charlie Poole (charlie.poole) wrote : Re: [Bug 1083821] Re: NUnit runner crashes when test gives StackOverflowException

Oddly, I changed it from new to triaged (according to the page
display) but the full log shows I changed it from invalid to triaged.
Oh well. :-)

I'm adverse to considering a crash invalid, provided we can reproduce
the problem. I'll try it myself.

Nicholas, you haven't said what your environment is.

Charlie

On Wed, Nov 28, 2012 at 12:03 AM, Simone Busoli
<email address hidden> wrote:
> I marked the issue as invalid initially, which is what it looked like
> and I'm not yet sure about the validity for as I said, I couldn't
> reproduce it.
>
> Nicholas, SOEs is not really what the tool is supposed to discover though, but I concur that a more proper handling, if any is possible, would be nice.
> If you have a repro that you can submit please do so, as I mentioned I wasn't able to crash the GUI nor the console.
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/1083821
>
> Title:
> NUnit runner crashes when test gives StackOverflowException
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunitv2/+bug/1083821/+subscriptions

Revision history for this message
Nicholas Devenish (ndevenish) wrote :

Ah, sorry:

Running windows 7 on a virtualbox VM, on Visual Studio Professional 2012. My program runs on .net 4.0, but the small test I ran to diagnose it was running on 4.5. Using NUnit 2.6.2, both from NuGet and for the runner gui. I'm not using the NUnit visual studio test tool for it, because it fails to close some of my assemblies.

Revision history for this message
Fabian Schmied (fabian-schmied) wrote :

I request that this feature is given high priority. When production code causes a StackOverflowException, I need to have my test runner show me:

- that a StackOverflowException happened,
- what test case caused the StackOverflowException, and
- what's the stack trace up to the recursive cycle.

I.e, roughly the same a s with every ordinary exception.

Revision history for this message
Simone Busoli (simone.busoli) wrote : Re: [Nunit-core] [Bug 1083821] Re: NUnit runner crashes when test gives StackOverflowException

Fabian, how would you expect NUnit to provide you with these details if
.NET does not allow* managed code to catch a StackOverflowException?

*Remarks section:
http://msdn.microsoft.com/en-us/library/system.stackoverflowexception(v=vs.110).aspx

On Wed, Apr 24, 2013 at 10:34 AM, Fabian Schmied <<email address hidden>
> wrote:

> I request that this feature is given high priority. When production code
> causes a StackOverflowException, I need to have my test runner show me:
>
> - that a StackOverflowException happened,
> - what test case caused the StackOverflowException, and
> - what's the stack trace up to the recursive cycle.
>
> I.e, roughly the same a s with every ordinary exception.
>
> --
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
> https://bugs.launchpad.net/bugs/1083821
>
> Title:
> NUnit runner crashes when test gives StackOverflowException
>
> Status in NUnit V2 Test Framework:
> Triaged
>
> Bug description:
> Made a brand new test project, and in the default TestMethod1 method:
>
> [Test]
> public void TestMethod1()
> {
> TestMethod1();
> }
>
> The runner application gives "NUnit-Agent has stopped working", and
> then the main GUI crashes out when anything else is done with it. The
> runner reports 2.6.2.12296 as it's version.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunitv2/+bug/1083821/+subscriptions
>
> _______________________________________________
> Mailing list: https://launchpad.net/~nunit-core
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~nunit-core
> More help : https://help.launchpad.net/ListHelp
>

affects: nunitv2 → nunit-console
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.