-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
How to debug StackOverflowException #9195
Comments
@janvorli your stack overflow work was in 2.0 I think.? |
Any news about this? Any idea how to get at least some idea about what is going on? |
The only thing that could work is to run the app under lldb and when it hits the stack overflow, load the libsosplugin.so and run "clrstack -f". |
@janvorli Any suggestions for doing this on Windows? |
SO questions suggest either using windbg or reproing it in VS while debugging. This is a bit hard when the issue is hard to repro and happens in processes spawned by the entry process (or when it's not happening on windows). Just printing out the stack trace would be so helpful ... |
@cdmihai Presumably at this point it would be hard to print the stack trace (there is no stack with which to work, after all). |
@janvorli How do Microsoft dev debug this kind of bug in prod? |
This is exactly how Golang do. (In stacktrace below, I elide some frame manually)
|
In other words, like the CoreCLR allocates an |
Golang has dynamic (goroutine) stack which is in heap. Golang runtime grows/shrinks stack size as needed. I'm not familiar with dotnet. I guess managed code run on native thread stack. |
That's right. We already run sigsegv handler on an alternate stack to be able to at least print the message and not just silently die. This alternate stack is kept as small as possible since we need to allocate it for each thread. That size would likely not be enough to run the code that's necessary to dump the stack trace. But since we've recently switched to allocating the alternate stack space using mmap, we could actually reserve larger VM space and commit just the size needed by the regular sigsegv handling. On stack overflow, we could commit more of the space so that we have enough to dump the stack trace. |
I currently have a problem where I cannot even get Stack Trace with Visual Studio debugger... So anything which could help us to get a clue would be welcome... :-) [Edit: We solved this problem in the mean time via "print-debugging" - we used log entries to nail down the exact place where the code crashes, so it's not urgent any more...] |
+1 :| |
Does using windbg and SOS still work with core? As described here: https://stackoverflow.com/a/49882734/684096 |
Where is the stacktrace dumped to, standard err/output? I am debugging in an orchestrated containerized environment, when app crashes because of StackOverFlowException the containers goes away and all is left is stderr and stdout, |
Wait ... you're already outputting Process is terminating due to a StackOverflowException ... Too bad we can't walk down the frames and output them. This can be done in a constant amount of RAM. |
Got this from the console ...
Put a breakpoint in the action ... it's not getting that far ... so how do I debug stack overflows in DI ? |
I'd like to add that when running ASP.NET Core in an Azure App Service it's even more painful because the It seems in Azure the only solution is to enable short-term crash monitoring, then reproduce the issue (assuming you can even consistently and reliably reproduce it in the first place!), then download the multi-gigabyte-sized So I'd describe the issue more broadly as: the overall developer UX for diagnosing and investigating stack-overflow crashes in .NET Core is abysmal and this is especially disappointing given Microsoft has a generally good reputation for developer-tooling - and we never had this problem in .NET Framework 1.x, where we could at least Out of curiosity (and I know it's off-topic), but why doesn't |
Eventlog.xml is part of the Application Event Log feature in Azure App Services. I'll find out the owners and try out the E2E scenario with StackOverFlow. It sounds like we might have a scenario gap here. |
Or you can fix #8947 to at least allow catch (StackOverflowException) to work. The original reason for denying it is long gone. StackOverflow has been theoretically recoverable forever. Once having rolled back 4k of stack you can call the native function _resetstkoflw https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/resetstkoflw?view=msvc-160 |
@Daniel15 commented on Wed Oct 25 2017
I'm getting this error while moving a site from ASP.NET Core 1.1 on Mono to ASP.NET Core 2.0 on .NET Core 2.0:
How do I get a full stack trace for the
StackOverflowException
to determine where it's coming from?The text was updated successfully, but these errors were encountered: