-
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
Core dump of StackOverflowException does not provide any information about the source of the exception #12752
Comments
cc @mikem8361 |
|
I can repo the problem that
|
The managed stack unwinder (in the DAC) is having problems with the stack overflow probably because we are on an alternate stack when the process aborts on an overflow. |
See issue: dotnet/diagnostics#66 |
@mikem8361 thank you for detailed explanation! I do the following in the container I run from the committed image with dump. Install dotnet-sdk: apt update && apt install -y wget gpg; \
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg; \
mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/; \
wget -q https://packages.microsoft.com/config/debian/9/prod.list; \
mv prod.list /etc/apt/sources.list.d/microsoft-prod.list; \
chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg; \
chown root:root /etc/apt/sources.list.d/microsoft-prod.list
apt-get install -y apt-transport-https; \
apt-get update; \
apt-get install -y dotnet-sdk-2.2 Install dotnet-sos: dotnet tool install -g dotnet-sos --version 1.0.3-preview5.19251.2 And then I get following when I try to install sos: dotnet sos install
No executable found matching command "dotnet-sos" So instead I have to run ~/.dotnet/tools/dotnet-sos install Then no matter whether I use linux core dump with or without root@3a286c492701:/app# lldb-3.9 $(which dotnet) --core ./core
(lldb) target create "/usr/bin/dotnet" --core "./core"
Core file '/app/./core' (x86_64) was loaded.
(lldb) clrstack
OS Thread Id: 0x8 (1)
Child SP IP Call Site
00007FFF188799E0 00007f91c509efff [HelperMethodFrame: 00007fff188799e0]
00007FFF18879B60 00007F914B42D0AF /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Private.CoreLib.dll!Unknown
00007FFF18879B70 00007F914B42CC77 /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Private.CoreLib.dll!Unknown
00007FFF18879B90 00007F914B4290A3 /app/Demo.dll!Unknown
00007FFF18879E58 00007f91c454f17f [GCFrame: 00007fff18879e58]
00007FFF1887A260 00007f91c454f17f [GCFrame: 00007fff1887a260]
(lldb) exit
root@3a286c492701:/app# lldb-3.9 $(which dotnet) --core /tmp/coredump.8
(lldb) target create "/usr/bin/dotnet" --core "/tmp/coredump.8"
Core file '/tmp/coredump.8' (x86_64) was loaded.
(lldb) setsymbolserver -ms
Added Microsoft public symbol server
(lldb) clrstack
OS Thread Id: 0x8 (1)
Child SP IP Call Site
00007FFF188799E0 00007f91c5cb8b5a [HelperMethodFrame: 00007fff188799e0]
00007FFF18879B60 00007F914B42D0AF /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Private.CoreLib.dll!Unknown
00007FFF18879B70 00007F914B42CC77 /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.5/System.Private.CoreLib.dll!Unknown
00007FFF18879B90 00007F914B4290A3 /app/Demo.dll!Unknown
00007FFF18879E58 00007f91c454f17f [GCFrame: 00007fff18879e58]
00007FFF1887A260 00007f91c454f17f [GCFrame: 00007fff1887a260]
(lldb) clrthreads
ThreadCount: 3
UnstartedThread: 0
BackgroundThread: 2
PendingThread: 0
DeadThread: 0
Hosted Runtime: no
Lock
DBG ID OSID ThreadOBJ State GC Mode GC Alloc Context Domain Count Apt Exception
1 1 8 0000000001A81820 20020 Preemptive 00007F90240459D0:00007F9024045B30 0000000001ACF4F0 0 Ukn <Invalid Object> (00007f902402dde8)
9 2 12 0000000001AD1D00 21220 Preemptive 0000000000000000:0000000000000000 0000000001ACF4F0 0 Ukn (Finalizer)
10 3 13 00007F8F0C0009F0 1020220 Preemptive 0000000000000000:0000000000000000 0000000001ACF4F0 0 Ukn (Threadpool Worker)
(lldb) setsymbolserver
Server: http://msdl.microsoft.com/download/symbols/ |
I forgot that the "missing metadata" fix that causes the !UNKNOWN in clrstack, etc wasn't fixed in the preview5 sos. If you install version 1.0.4-preview6.19272.1 of dotnet-sos and re-install, it will fix this problem. This version or one really close will be the "preview6" version of SOS and our global tools.
And yes, you will either add "$HOME/.dotnet/tools" to your PATH or execute the tool the way you did. |
I played more with it and all works good with dotnet-sos 1.0.4-preview6 and minidumps created with However I still cannot see symbols in core dumps created by Linux kernel. Will native core dumps ever be supporter by SOS? Or will it only work with minidumps created by CLR? If not then I guess that's another reason to use k8s over swarm. Do I understand correctly that issue with StackOverflow will be fixed as part of dotnet/diagnostics#66 issue? |
Linux system core dumps will work with SOS if you set the “coredump_filters” to 0x3f (see http://man7.org/linux/man-pages/man5/core.5.html for more details):
$ echo 0x3f > /proc/self/coredump_filter
$ ulimit -c unlimited
$ <run faulting application>
But on Linux “createdump” (COMPlus_DbgEnableMiniDump=1) is still the best way to generate a fairly small core dump that has all the managed state.
Yes, the SOS stack overflow problems should be solved with that issue.
|
We are moving to containerized environment hosted with Docker Swarm and I want to understand how to track down StackOverflowException if it occurs.
I create simple application and build it in a container in Debug mode to avoid tail recursion optimization and force StackOverflowException.
Entry point script to set ulimit core to unlimited to enable core dump creation, because Docker Swarm does not support passing it in:
I build the container and try to analyze the dump:
Neither
clrstack
norclrstack -f
shows useful information about the source of StackOverflowException. Though it is obvious that repeated lines with00007F47BE79979E
are due to StackOverflowException. I am new to memory dump debugging especially with lldb inside Docker container. Am I missing something? I have tried to collect a minidump by settingENV COMPlus_DbgEnableMiniDump=1 \ COMPlus_DbgMiniDumpType=4
to see if it differs even though it is not possible to run container with
--cap-add=SYS_PTRACE
in Swarm, but it shows same result and the dump itself was about 12GB which is quite big size for a minidump.On a side note, I tried to see if I can get some more details of regular exception in core dumps created on crash and I haven't found any symbols. It shows
!Unknown
instead of symbol name:versus full minidump
Is there any possibility to view symbols for regular core dumps because there is currently no way to use minidumps in Docker Swarm because of lack of support of
--cap-add=SYS_PTRACE
and also they are very heavy?The text was updated successfully, but these errors were encountered: