Repository navigation
Closed
Description
One of the possible stack traces that gdb shows after loading a core dump:
$ gdb clr-debug/corerun core
Reading symbols from clr-debug/corerun...done.
[New LWP 22222]
[New LWP 22214]
[New LWP 22216]
[New LWP 22218]
[New LWP 22220]
[New LWP 22215]
[New LWP 22219]
[New LWP 22223]
[New LWP 22221]
[New LWP 22217]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `clr-debug/corerun tests-release/JIT/Methodical/cctor/misc/threads1_cs_r/threads'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000000 in ?? ()
[Current thread is 1 (Thread 0xadbff450 (LWP 22222))]
(gdb) bt
#0 0x00000000 in ?? ()
dotnet/coreclr#1 0xb650a34c in DomainLocalModule::GetPrecomputedNonGCStaticsBasePointer (this=0xb1c2a594) at /home/mskvortsov/git/coreclr/src/vm/appdomain.hpp:234
dotnet/coreclr#2 0xb648c48c in CallDescrWorker (pCallDescrData=0xadbfe4c0) at /home/mskvortsov/git/coreclr/src/vm/callhelpers.cpp:135
dotnet/coreclr#3 0xb648c32e in CallDescrWorkerWithHandler (pCallDescrData=0xadbfe4c0, fCriticalCall=0) at /home/mskvortsov/git/coreclr/src/vm/callhelpers.cpp:78
dotnet/coreclr#4 0xb648d374 in MethodDescCallSite::CallTargetWorker (this=0xadbfe62c, pArguments=0xadbfe6a0, pReturnValue=0x0, cbReturnValue=0) at /home/mskvortsov/git/coreclr/src/vm/callhelpers.cpp:645
dotnet/coreclr#5 0xb637b4ee in MethodDescCallSite::Call (this=0xadbfe62c, pArguments=0xadbfe6a0) at /home/mskvortsov/git/coreclr/src/vm/callhelpers.h:433
dotnet/coreclr#6 0xb649a438 in ThreadNative::KickOffThread_Worker (ptr=0xadbfeab8) at /home/mskvortsov/git/coreclr/src/vm/comsynchronizable.cpp:257
dotnet/coreclr#7 0xb644b07c in ManagedThreadBase_DispatchInner (pCallState=0xadbfe93c) at /home/mskvortsov/git/coreclr/src/vm/threads.cpp:9187
dotnet/coreclr#8 0xb644e8a8 in ManagedThreadBase_DispatchMiddle (pCallState=0xadbfe93c) at /home/mskvortsov/git/coreclr/src/vm/threads.cpp:9238
dotnet/coreclr#9 0xb644e760 in ManagedThreadBase_DispatchOuter(ManagedThreadCallState*)::$_6::operator()(ManagedThreadBase_DispatchOuter(ManagedThreadCallState*)::TryArgs*) const::{lambda(Param*)#1}::operator()(Param*) const (this=0xadbfe884, pParam=0xadbfe8e8) at /home/mskvortsov/git/coreclr/src/vm/threads.cpp:9476
dotnet/coreclr#10 0xb644e620 in ManagedThreadBase_DispatchOuter(ManagedThreadCallState*)::$_6::operator()(ManagedThreadBase_DispatchOuter(ManagedThreadCallState*)::TryArgs*) const (this=0xadbfe8d0, pArgs=0xadbfe8d8) at /home/mskvortsov/git/coreclr/src/vm/threads.cpp:9478
dotnet/coreclr#11 0xb644adb0 in ManagedThreadBase_DispatchOuter (pCallState=0xadbfe93c) at /home/mskvortsov/git/coreclr/src/vm/threads.cpp:9515
dotnet/coreclr#12 0xb644aee6 in ManagedThreadBase_FullTransitionWithAD (pAppDomain=..., pTarget=0xb649a231 <ThreadNative::KickOffThread_Worker(void*)>, args=0xadbfeab8, filterType=ManagedThread) at /home/mskvortsov/git/coreclr/src/vm/threads.cpp:9536
dotnet/coreclr#13 0xb644ae6e in ManagedThreadBase::KickOff (pAppDomain=..., pTarget=0xb649a231 <ThreadNative::KickOffThread_Worker(void*)>, args=0xadbfeab8) at /home/mskvortsov/git/coreclr/src/vm/threads.cpp:9571
dotnet/coreclr#14 0xb649a998 in ThreadNative::KickOffThread (pass=0x1063f0) at /home/mskvortsov/git/coreclr/src/vm/comsynchronizable.cpp:376
dotnet/coreclr#15 0xb6441e1c in Thread::intermediateThreadProc (arg=0xd4ec0) at /home/mskvortsov/git/coreclr/src/vm/threads.cpp:2584
dotnet/coreclr#16 0xb69a2f02 in CorUnix::CPalThread::ThreadEntry (pvParam=0x10c048) at /home/mskvortsov/git/coreclr/src/pal/src/thread/thread.cpp:1749
dotnet/coreclr#17 0xb6f295b4 in start_thread (arg=0x0) at pthread_create.c:335
dotnet/coreclr#18 0xb6d1caac in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:89 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Activity
mskvortsov commentedon Jun 22, 2017
@dotnet/arm32-contrib Can someone reproduce this? I use a script like this:
mskvortsov commentedon Jun 22, 2017
And here is another kind of a stack trace I get:
janvorli commentedon Jun 22, 2017
@mskvortsov regarding the 2nd dump, are you sure the failure point is in the thread whose stack you've dumped? My experience is that when you load a dump with SIGSEGV, the faulting thread is often different from the thread 1 that it shows by default. I usually have to do bt for all threads and then pinpoint the one that have caused the problem by looking at the current instruction's operands and checking if the related memory address is valid or not.
mskvortsov commentedon Jun 22, 2017
@janvorli I didn't know the first thread gdb shows may differ from the failing one, thanks for pointing this out!
I have checked and can confirm the 2nd dump is indeed from the failing thread:
hqueue commentedon Jun 23, 2017
@mskvortsov Unfortunately, I couldn't reproduce this one using your
repro.shon Rpi3 with last week CoreCLR. (commit a2ecf15) until more than 100 trials(maybe).My rpi3 use Ubuntu mate (16.04) with glibc 2.23 and libunwind8(1.1-4.1) where
access_memis defined.alpencolt commentedon Jun 28, 2017
@janvorli I've reproduced this issue and it looks that crash occurred on Thread 1:
Almost all other threads is waiting on:
It look crash occurred on garbage collecting. I've got the
SIGSEGVon:alpencolt commentedon Jun 28, 2017
We use Exynos 5422 which has 4 A7 and 4 A15 cores. The funniest thing is that when I run dotnet only on one type of core (e.g only on A7 or A15) by using
tasksetbug cannot be reproduced. But if I use mixed mode (liketaskset -c 2-5 corerun ...) crash occurs.alpencolt commentedon Jul 3, 2017
Guys from Mono faced problem caused different cache size in big.LITTLE architectire:
http://www.mono-project.com/news/2016/09/12/arm64-icache/
I've checked source code and
__clear_cachis used inFlushInstructionCache()only, I'm not sure that it's our case.Bug cannot be reproduced on Samsung Z3 (btw it has only 2 cores with identical architectures.).
lemmaa commentedon Aug 4, 2017
@alpencolt , Can you please make a chance to apply the patch, https://github.com/mono/mono/pull/3549/files, and share the results here? It is not urgent but it seems to be worth try if you agree.
alpencolt commentedon Aug 4, 2017
@lemmaa I will try after closing current issues. Do you have any considerations where
flush_icache()may occur?alpencolt commentedon Sep 6, 2017
I've got following exception on the latest master:
This assertion failed:
alpencolt commentedon Sep 15, 2017
Debug version failed with the same exception as #7825. Back trace:
After few times test were passed it failed with this stack. So as you can see there is garbage collection on
JIT_NewArr1()calling. The reason is thatGetGCSafeMethodTable()returns0.Also I've found that before crash StackWalker iterates over big amount of frames and there is one frame with
Frame::FRAME_ATTR_EXCEPTIONattribute.alpencolt commentedon Sep 28, 2017
Crash on debug is another error dotnet/coreclr#14238. Root cause is the same - assertion in
System.Threading.ExecutionContext.Restore()3 remaining items
kbaladurin commentedon Apr 16, 2018
Yes, crash is still reproducible for me (on dotnet/coreclr@91ce6ed):
kernel version is 4.9.58-71:
We use processor with big.LITTLE architecture:
RussKeldorph commentedon Apr 18, 2018
@kbaladurin @okodron Any chance you guys could investigate this? We don't currently have any way to repro it.
alpencolt commentedon Apr 18, 2018
@echesakovMSFT @RussKeldorph we still investigating this issue but have a lot of other work with higher priority, so I'm not sure that it will be closed soon.
Crash is reproduced only on devices with big.LITTLE architecture.
There is chance that there is something wrong in environment and we will try to run it on new boards.
RussKeldorph commentedon Apr 18, 2018
Ok, I think we'll most likely have to kick this out of 2.1 for now. I don't see how we can make progress on it soon enough.
RussKeldorph commentedon Apr 18, 2018
I'm inclined to think this is more likely related to PAL or maybe GC than codegen (do we query the processor cache size anywhere?), but feel free to clear the area label if you disagree.
janvorli commentedon Dec 10, 2018
This issue is due to an issue described in https://www.kayaksoft.com/blog/2016/05/11/random-sigill-on-arm-board-odroid-ux4-with-gdbgdbserver/. The article also describes a kernel patch that mitigates the problem. I have finally got to trying to patch my Odroid XU4 kernel (XU4 is based on Exynos 5422) so that it returns cache line size 32 unconditionally for both little and big cores. And I can confirm it fixes the problem.
With that patch applied, I could build managed parts of coreclr repo and all the thousands of coreclr managed tests just fine. Without that, I couldn't even build System.Private.CoreLib.dll.
It seems there is no way to fix that programatically, as the cache can be flushed only by the kernel on arm and the issue is in the kernel code.
Btw, ARM doc has some details on different cache sizes in heterogenous systems: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0438e/BABHAEIF.html
It seems that Linux kernel has a fix for the same kind of issue for ARM64 (https://osdn.net/projects/android-x86/scm/git/kernel/commits/116c81f427ff6c5380850963e3fb8798cc821d2b), but not for ARM.
alpencolt commentedon May 29, 2019
With introducing Tiered JIT this issue occurs much more frequent and makes CoreCLR almost unusable on ARM32 CPUs with big.LITLLE architecture (thanks they are not very popular).
Unfortunately we can not solve this issues from user space (like Mono did it for ARM64), so we're going to prepare fix to linux kernel like it was made for ARM64 (torvalds/linux@116c81f).
Patch from article helps:
But I'm not sure that it will be accepted in upstream=)
janvorli commentedon Jun 17, 2019
@alpencolt can we close the issue? There doesn't seem to be anything we can do about the issue as it is a kernel problem.
alpencolt commentedon Jun 18, 2019
@janvorli yes.
I will add link to patch when it will be in upstream.