dotnet crashing with segmentation fault in libcoreclr.so
Dotnet app is crashing on high load with Segmentation fault from libcoreclr.so;
The application is handling http requests via Kestrel + Libuv. Kestrel limits are: MaxConcurrentConnections: 1500, AllowSynchronousIO: true, Libuv thread count: 16. On higher load app is crashing with seg fault.
Backtrace of crash dump # 1:
#0 0x00007f6e56180d95 in Frame::SafeGetGSCookiePtr(Frame*) () from /opt/app/bin/libcoreclr.so
#1 0x00007f6e561da830 in CrawlFrame::GotoNextFrame() () from /opt/app/bin/libcoreclr.so
#2 0x00007f6e561d9f6c in StackFrameIterator::NextRaw() () from /opt/app/bin/libcoreclr.so
#3 0x00007f6e561d81c8 in Thread::StackWalkFramesEx(REGDISPLAY*, StackWalkAction (*)(CrawlFrame*, void*), void*, unsigned int, Frame*) () from /opt/app/bin/libcoreclr.so
#4 0x00007f6e561d856c in Thread::StackWalkFrames(StackWalkAction (*)(CrawlFrame*, void*), void*, unsigned int, Frame*) () from /opt/app/bin/libcoreclr.so
#5 0x00007f6e56444109 in ScanStackRoots(Thread*, void (*)(Object**, ScanContext*, unsigned int), ScanContext*) () from /opt/app/bin/libcoreclr.so
#6 0x00007f6e56443f45 in GCToEEInterface::GcScanRoots(void (*)(Object**, ScanContext*, unsigned int), int, int, ScanContext*) () from /opt/app/bin/libcoreclr.so
#7 0x00007f6e563e73fb in SVR::gc_heap::mark_phase(int, int) () from /opt/app/bin/libcoreclr.so
#8 0x00007f6e563e3ef2 in SVR::gc_heap::gc1() () from /opt/app/bin/libcoreclr.so
#9 0x00007f6e563d6a8d in SVR::gc_heap::garbage_collect(int) () from /opt/app/bin/libcoreclr.so
#10 0x00007f6e563d54c8 in SVR::gc_heap::gc_thread_function() () from /opt/app/bin/libcoreclr.so
#11 0x00007f6e563d5202 in SVR::gc_heap::gc_thread_stub(void*) () from /opt/app/bin/libcoreclr.so
#12 0x00007f6e56445d78 in (anonymous namespace)::CreateNonSuspendableThread(void (*)(void*), void*, char const*)::$_1::__invoke(void*) () from /opt/app/bin/libcoreclr.so
#13 0x00007f6e56581b62 in CorUnix::CPalThread::ThreadEntry(void*) () from /opt/app/bin/libcoreclr.so
#14 0x00007f6e57a01e25 in start_thread (arg=0x7f6ddc482700) at pthread_create.c:308
#15 0x00007f6e56f0cbad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
Backtrace of crash dump # 2:
#0 0x00007f2da720628e in SVR::gc_heap::mark_object_simple(unsigned char**, int) () from /opt/app/bin/libcoreclr.so
#1 0x00007f2da72095a1 in SVR::GCHeap::Promote(Object**, ScanContext*, unsigned int) () from /opt/app/bin/libcoreclr.so
#2 0x00007f2da7108b8e in GcInfoDecoder::ReportUntrackedSlots(GcSlotDecoder&, REGDISPLAY*, unsigned int, void (*)(void*, Object**, unsigned int), void*) () from /opt/app/bin/libcoreclr.so
#3 0x00007f2da7107186 in GcInfoDecoder::EnumerateLiveSlots(REGDISPLAY*, bool, unsigned int, void (*)(void*, Object**, unsigned int), void*) () from /opt/app/bin/libcoreclr.so
#4 0x00007f2da6f847f6 in EECodeManager::EnumGcRefs(REGDISPLAY*, EECodeInfo*, unsigned int, void (*)(void*, Object**, unsigned int), void*, unsigned int) () from /opt/app/bin/libcoreclr.so
#5 0x00007f2da7066c10 in GcStackCrawlCallBack(CrawlFrame*, void*) () from /opt/app/bin/libcoreclr.so
#6 0x00007f2da6fecf50 in Thread::MakeStackwalkerCallback(CrawlFrame*, StackWalkAction (*)(CrawlFrame*, void*), void*) () from /opt/app/bin/libcoreclr.so
#7 0x00007f2da6fed191 in Thread::StackWalkFramesEx(REGDISPLAY*, StackWalkAction (*)(CrawlFrame*, void*), void*, unsigned int, Frame*) () from /opt/app/bin/libcoreclr.so
#8 0x00007f2da6fed56c in Thread::StackWalkFrames(StackWalkAction (*)(CrawlFrame*, void*), void*, unsigned int, Frame*) () from /opt/app/bin/libcoreclr.so
#9 0x00007f2da7259109 in ScanStackRoots(Thread*, void (*)(Object**, ScanContext*, unsigned int), ScanContext*) () from /opt/app/bin/libcoreclr.so
#10 0x00007f2da7258f45 in GCToEEInterface::GcScanRoots(void (*)(Object**, ScanContext*, unsigned int), int, int, ScanContext*) () from /opt/app/bin/libcoreclr.so
#11 0x00007f2da71fc3fb in SVR::gc_heap::mark_phase(int, int) () from /opt/app/bin/libcoreclr.so
#12 0x00007f2da71f8ef2 in SVR::gc_heap::gc1() () from /opt/app/bin/libcoreclr.so
#13 0x00007f2da71eba8d in SVR::gc_heap::garbage_collect(int) () from /opt/app/bin/libcoreclr.so
#14 0x00007f2da71ea4c8 in SVR::gc_heap::gc_thread_function() () from /opt/app/bin/libcoreclr.so
#15 0x00007f2da71ea202 in SVR::gc_heap::gc_thread_stub(void*) () from /opt/app/bin/libcoreclr.so
#16 0x00007f2da725ad78 in (anonymous namespace)::CreateNonSuspendableThread(void (*)(void*), void*, char const*)::$_1::__invoke(void*) () from /opt/app/bin/libcoreclr.so
#17 0x00007f2da7396b62 in CorUnix::CPalThread::ThreadEntry(void*) () from /opt/app/bin/libcoreclr.so
#18 0x00007f2da8816e25 in start_thread (arg=0x7f2d2cfa3700) at pthread_create.c:308
#19 0x00007f2da7d21bad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
System properties:
Runtime Environment:
OS Name: centos
OS Version: 7
OS Platform: Linux
RID: centos.7-x64
Base Path: /usr/share/dotnet/sdk/2.1.403/
Host (useful for support):
Version: 2.1.5
Commit: 290303f510
.NET Core SDKs installed:
2.1.403 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Are you using any interop with native code? The above looks like corrupted stack - that is typically sign of memory corruption originating in bad PInvoke, or potentially HW issue (check if you get the same problem on more than 1 machine / VM host).
cc @janvorli @leculver
@karelz thanks for your answer. Yes, I am using interop with unmanaged code lib, but I tested with same lib managed code version, and app still crashes. Another lib in my app, that possibly is using interop is Microsoft.Data.Sqlite, but probably this is not the cause, because it is called only a few times on app start and is not used in HTTP requests processing. There are several types of physical machines, but the older ones with less resources are more prone to crash (32gb ram, 92% used). Some cpu info:
Intel(R) Xeon(R) CPU E5645 @ 2.40GHz
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 12288K
NUMA node0 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23
NUMA node1 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22
You have now 2 options - either investigate the dumps and hope to spot some pattern / sign, or create a small repro and then debug that.
Not actionable, closing. If you find more details and pin point the problem and it turns out to be in .NET Core, feel free to reopen.
Did you find a solution to this?
@OliverDjur nope, but with core 2.2 version, crash count decreased significantly.