-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide useful error message when agent crashes with a stack overflow exception #391
Comments
Do we know of any socket exceptions that are still happening to people that are not stack overflows? For any socket exception except our own shutdown, we could print out a suggestion to use --inprocess to diagnose the issue. |
@jnm2 Good idea, as a point of last fallback. I'd like to work on catching as many 'know agent crash' cases as we can, and providing useful debug information. The two I know about right now are Stack Overflow, and none CLR exceptions. But yes, adding this for the cases we don't know about yet sounds sensible. 🙂 |
If that's "unknown" then it should be completely preventable. The primary engine should never start a process that requests a CLR that isn't installed. It's supposed to see the problem and report the error without even attempting to start the process. |
Whoops - CLS, not CLR! 😅 I was meaning non-CLS compliment exceptions, I.e. from unmanaged code. Am I right that they can currently crash the agent, or am I remembering incorrectly? |
I'm not sure. I wouldn't be surprised. Easy to test though. Should maybe be tested in the framework first. If the framework let's it slip through then my guess is that the engine/agent won't make things any better. |
@ChrisMaddock I could look into it. |
Yes please! Be careful with this one, we think there's a wider bug at the moment which is causing the general error reporting functionality here not to work at all. See #700. Have a look - you might be able to solve both at the same time? 🙂 |
This is what I found.
The class tested had two methods that were tested:
After adding this method and running a test on it, resulted in the problematic scenario
|
Aren't both kinds of errors (Exceptions and bad exit code) received via events, called on different threads? Seems like this is a potential race condition. |
Hey @mano-si. So - your third bullet point was the one I was intending this issue to tackle, how we can better inform the user what's happening when it's their code that's crashing the console. This was my thinking behind adding this particular code to If I understand correctly, we should be able to detect this specific case by the exit code "-1073741571", and show the user a friendly error message as to what the problem might be. (And also suppress all the stack traces that are shown at the moment - which are really just NUnit internals, as far as a user is concerned) Does help explain my thought process from when I created this issue? If I'm honest, I'm not entirely sure it will be possible - but I'm hoping it will work! 😁 |
Yes, they are received via events. I am not very familiar with the internals yet and won't be able to confirm you for sure if its race condition or not. It is possible. |
Yes I was able to understand that's what you might have intended. 😄 We could do that I assume. Provide a meaningful information like 'StackOverflow in one the tests.' But, I don't think we could be able to provide more insightful information (eg. TestName etc. ) . Regarding hiding the server stackTrace, that's something I need to look into. |
No, that makes sense. But any infos better than what we currently have here, in my opinion. 😊 |
I think @CharliePoole was right about the race condition. I put a @ChrisMaddock I was able to generate the actual 'StackOverflow' exception on the console by changing |
Great work on the race condition! I wonder if there's anything we can do to solve that? I don't think changing I'm afraid I'm not following why adding the special case in |
@mano-si That makes sense. Code in |
Adding the special case in And as you suggested, we could also add this condition in |
IIRC the code in |
When the agent exits uncleanly, we currently look at the exit code and provide a more suitable error message.
nunit-console/src/NUnitEngine/nunit.engine/Services/TestAgency.cs
Lines 287 to 324 in ae37176
This currently only checks for NUnit-specific error codes, but we could also check for -1073741571 - which I believe is the .NET exit code specific to Stack Overflow exceptions - an exception which could be thrown by user code, which we have no other way of handing.
The text was updated successfully, but these errors were encountered: