Repository navigation
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
Milestone
Description
Notes
- This only seems to reproduce with the Release configuration, not Debug.
- This is just a targeted reproduction that was originally found when running this command from the repo root:
./build.sh clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs+libs.tests -rc Release -lc Release /p:TestNativeAot=true - Originally found when trying to reproduce another issue: [NativeAOT] Enable Reflection library tests in Linux-ARM64 #70010
Reproduction Steps
- On ARM64 Ubuntu 18.04
- Make sure bin artifacts are cleared out to rebuild
rm -rf /home/ubuntu/code/runtime/artifacts/bin/System.Reflection.Tests/ - Make sure obj artifacts are cleared out to rebuild
rm -rf /home/ubuntu/code/runtime/artifacts/obj/System.Reflection.Tests/ - Navigate to reflection tests
cd ~/code/runtime/src/libraries/System.Reflection/tests - Run tests for NativeAOT
../../../../dotnet.sh build /t:Test /p:TestNativeAot=true -c Release -v d
Debugging Steps (after running Reproduction Steps):
- Setup symbols for debugging
cp /home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release/*.dbg /home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release/ilc - Point gdb to ilc
gdb /home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release/ilc/ilc - Tell gdb where symbols are
set debug-file-directory /home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release/ilc - Run against reflection tests
r @"/home/ubuntu/code/runtime/artifacts/obj/System.Reflection.Tests/Release/net7.0/native/System.Reflection.Tests.ilc.rsp"
Error
Thread 37 ".NET ThreadPool" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xffbe66ffd1c0 (LWP 18899)]
GenTreeUseEdgeIterator::AdvanceCall<0> (this=0xffbe66ffb508) at /home/ubuntu/code/runtime/src/coreclr/jit/gentree.cpp:9650
9650 m_statePtr = arg->GetLateNext();
(gdb) bt
#0 GenTreeUseEdgeIterator::AdvanceCall<0> (this=0xffbe66ffb508) at /home/ubuntu/code/runtime/src/coreclr/jit/gentree.cpp:9650
#1 GenTreeUseEdgeIterator::GenTreeUseEdgeIterator (this=0xffbe66ffb508, node=0xffbe5c036db0) at /home/ubuntu/code/runtime/src/coreclr/jit/gentree.cpp:9357
#2 0x0000ffbe88221e44 in Compiler::fgGetFirstNode (tree=0xffbe5c036db0) at /home/ubuntu/code/runtime/src/coreclr/jit/flowgraph.cpp:4119
#3 0x0000ffbe882e6e30 in Rationalizer::RewriteNodeAsCall (this=0xffbe66ffb768, use=0xffbe5c037d08, parents=..., callHnd=<optimized out>, entryPoint=..., arg1=0xffbe5c031e50, arg2=0x0) at /home/ubuntu/code/runtime/src/coreclr/jit/rationalize.cpp:163
#4 0x0000ffbe882e81fc in Rationalizer::RewriteIntrinsicAsUserCall (this=0xffbe66ffb508, use=<optimized out>, parents=...) at /home/ubuntu/code/runtime/src/coreclr/jit/rationalize.cpp:244
#5 Rationalizer::DoPhase()::RationalizeVisitor::PreOrderVisit(GenTree**, GenTree*) (this=<optimized out>, use=<optimized out>, user=<optimized out>) at /home/ubuntu/code/runtime/src/coreclr/jit/rationalize.cpp:818
#6 GenTreeVisitor<Rationalizer::DoPhase()::RationalizeVisitor>::WalkTree(GenTree**, GenTree*) (this=<optimized out>, use=<optimized out>, user=<optimized out>) at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.h:10673
#7 0x0000ffbe882e831c in GenTreeVisitor<Rationalizer::DoPhase()::RationalizeVisitor>::WalkTree(GenTree**, GenTree*) (this=<optimized out>, use=<optimized out>, user=<optimized out>) at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.h:11013
#8 0x0000ffbe882e8048 in Rationalizer::DoPhase (this=0xffbe66ffb768) at /home/ubuntu/code/runtime/src/coreclr/jit/rationalize.cpp:888
#9 0x0000ffbe882e1fe0 in Phase::Run (this=0xffbe66ffb768) at /home/ubuntu/code/runtime/src/coreclr/jit/phase.cpp:61
#10 0x0000ffbe881f2110 in Compiler::compCompile (this=<optimized out>, methodCodePtr=<optimized out>, methodCodeSize=<optimized out>, compileFlags=<optimized out>) at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.cpp:5029
#11 0x0000ffbe881f3658 in Compiler::compCompileHelper (this=0xffbe5c02e3b8, classPtr=<optimized out>, compHnd=<optimized out>, methodInfo=0xffbe66ffbe40, methodCodePtr=0xffbe66ffbc10, methodCodeSize=0xffbe66ffbe20, compileFlags=0xffbe66ffbc28)
at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.cpp:6753
#12 0x0000ffbe881f2e10 in Compiler::compCompile(CORINFO_MODULE_STRUCT_*, void**, unsigned int*, JitFlags*)::$_11::operator()(Compiler::compCompile(CORINFO_MODULE_STRUCT_*, void**, unsigned int*, JitFlags*)::__JITParam*) const (this=<optimized out>, __JITpParam=<optimized out>)
at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.cpp:5899
#13 Compiler::compCompile (this=0xffbe5c02e3b8, classPtr=0x436d80, methodCodePtr=0xffbe66ffbc10, methodCodeSize=0xffbe66ffbe20, compileFlags=0xffbe66ffbc28) at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.cpp:5918
#14 0x0000ffbe881f3f2c in jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::$_13::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::__JITParam*) const::{lambda(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::$_13::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::__JITParam*) const::__JITParam*)#1}::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::$_13::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::__JITParam*) const::__JITParam*) const (this=<optimized out>, __JITpParam=<optimized out>)
at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.cpp:7399
#15 jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::$_13::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::__JITParam*) const (this=<optimized out>, __JITpParam=<optimized out>) at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.cpp:7424
#16 jitNativeCode (methodHnd=0x436d78, classPtr=0x436d80, compHnd=0xffbe66ffbc70, methodInfo=0xffbe66ffbe40, methodCodePtr=0xffbe66ffbc10, methodCodeSize=0xffbe66ffbe20, compileFlags=0xffbe66ffbc28, inlineInfoPtr=0x0)
at /home/ubuntu/code/runtime/src/coreclr/jit/compiler.cpp:7426
#17 0x0000ffbe881f80a8 in CILJit::compileMethod (this=<optimized out>, compHnd=0xffbe66ffbc70, methodInfo=0xffbe66ffbe40, flags=<optimized out>, entryAddress=<optimized out>, nativeSizeOfCode=0x420968) at /home/ubuntu/code/runtime/src/coreclr/jit/ee_il_dll.cpp:276
#18 0x0000ffbe8846f4d4 in JitCompileMethod (ppException=0xffbe66ffbe30, pJit=0xffbe884310d0 <operator new(unsigned long, CILJitSingletonAllocator const&)::CILJitBuff>, thisHandle=0xffbe66ffbe38, callbacks=<optimized out>, methodInfo=<optimized out>, flags=<optimized out>,
entryAddress=0xffbe66ffbe28, nativeSizeOfCode=0xffbe66ffbe20) at /home/ubuntu/code/runtime/src/coreclr/tools/aot/jitinterface/jitwrapper.cpp:34
#19 0x0000ffff8075ae1c in ?? ()
#20 0x0000fffff7a45328 in ?? () from /home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release/ilc/libcoreclr.so
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
Activity
jkotas commentedon Jun 24, 2022
Could you please get a stacktrace of the crash with symbols? You may need to tell the gdb to load the symbols from
/home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release, or copy the*.dbgfiles from/home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Releaseto/home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release/ilc.Beau-Gosse-dev commentedon Jun 24, 2022
Thanks, @jkotas I was wondering how to get the symbols. I've updated the original issue with the symbol filled bt.
When running in gdb, I did see
warning: the debug information found in "/home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release/ilc/libclrjit.so.dbg" does not match "/home/ubuntu/code/runtime/artifacts/bin/coreclr/Linux.arm64.Release/ilc/libclrjit.so" (CRC mismatch).Is that actually an issue?
jkotas commentedon Jun 24, 2022
JIT crash in Rationalizer. cc @dotnet/jit-contrib
28 remaining items
am11 commentedon Jul 5, 2022
We can also detect if the argument is missing and adjust the condition accordingly. e.g. this is how we detect if
dsymutilsupports--minimizeon macOS:runtime/eng/native/functions.cmake
Lines 405 to 413 in eb123a7
hoyosjs commentedon Jul 5, 2022
This was llvm-objcopy 8, we probably need to check dynamically if we are going to support using RedHat's version of clang for RHEL7 (llvm 7)
jakobbotsch commentedon Jul 21, 2022
Assuming the above is resolved now. Are you still able to reproduce the issue and can you share a dump if so @Beau-Gosse-dev?
Beau-Gosse-dev commentedon Jul 21, 2022
So it seems like the second issue, not being able to build clr.alljits, is fixed. However, the original issue still reproduces. Here is the new BT from gdb (seems the same as the original issue).
@jakobbotsch When you say you want the dump is that generated in gdb with
generate-core-file ~/dumpfile? When call that, the output file is 4.6G, is that what you want me to upload? I may need to find a new place to host it, I'm not sure GitHub allows files that big.jakobbotsch commentedon Jul 21, 2022
Yes, that and the ilc folder contents would be helpful. You might be able to make a smaller repro using
--singlemethodtypenameand--singlemethodnameargs to ilc, if you can dig out the exact function it is compiling that is causing the problem (that is probably visible in the log if you do a run with--verboseand--parallelism 1first).jakobbotsch commentedon Jul 22, 2022
Looking at the dump clang's codegen for
AdvanceCalllooks incorrect. it is skipping a null check that is present in the source code. In fact, it is missing a lot of code present in the source code due to assuming this null check always passes.I can see that the JIT in the dump you sent me is built with clang-6. Can you try a newer version of clang? The codegen for this function looks completely different for me using clang-9.
jakobbotsch commentedon Jul 22, 2022
Pseudocode from clang-6 from your dump (without symbols):
Pseudocode from clang-9 (with symbols):
Beau-Gosse-dev commentedon Jul 22, 2022
Thanks! I created a new VM and installed clang-9 instead of just "clang" and that fixed the issue. I see that in the Linux Requirements it says clang-9. I must have just installed the default clang after seeing an error that clang was not found.