Skip to content

[NativeAOT] Assert when compiling System.Runtime.Tests #73027

Description

@VSadov

The assert happens with current bits from main.
I hoped that it could be somehow caused by the barrier issue that was fixed in #72919.

However the assert reproduces after the fix has been merged and appears to be deterministic.

It looks like it is happening in the constructor of DataflowAnalyzedMethodNode

        public DataflowAnalyzedMethodNode(MethodIL methodIL)
        {
            Debug.Assert(methodIL.OwningMethod.IsTypicalMethodDefinition);
here ==>    Debug.Assert(!CompilerGeneratedState.IsNestedFunctionOrStateMachineMember(methodIL.OwningMethod));
            _methodIL = methodIL;
        }
  Process terminated. Assertion failed.
     at ILCompiler.DependencyAnalysis.DataflowAnalyzedMethodNode..ctor(MethodIL methodIL) in /home/robox/vsadov/runtime01/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DataflowAnalyzedMethodNode.cs:line 27
     at ILCompiler.DependencyAnalysis.NodeFactory.<>c.<CreateNodeCaches>b__39_33(MethodILKey il) in /home/robox/vsadov/runtime01/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs:line 386
     at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     at ILCompiler.UsageBasedMetadataManager.AddDataflowDependency(DependencyList& dependencies, NodeFactory factory, MethodIL methodIL, String reason) in /home/robox/vsadov/runtime01/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs:line 931
     at Internal.IL.ILImporter.ImportCall(ILOpcode opcode, Int32 token) in /home/robox/vsadov/runtime01/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs:line 264
     at Internal.IL.ILImporter.ImportBasicBlock(BasicBlock basicBlock) in /home/robox/vsadov/runtime01/src/coreclr/tools/Common/TypeSystem/IL/ILImporter.cs:line 427
     at Internal.IL.ILImporter.ImportBasicBlocks() in /home/robox/vsadov/runtime01/src/coreclr/tools/Common/TypeSystem/IL/ILImporter.cs:line 311
     at Internal.IL.ILImporter.Import() in /home/robox/vsadov/runtime01/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs:line 156
     at ILCompiler.ILScanner.CompileSingleMethod(ScannedMethodNode methodCodeNodeNeedingCode) in /home/robox/vsadov/runtime01/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs:line 123
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
     at System.Threading.Tasks.TaskReplicator.Replica.Execute()
     at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
     at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
  Aborted

To repro, compile runtime and tests on a linux-arm64 machine like:

./build.sh -arch arm64 -os Linux -s clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs+libs.tests -rc Checked -lc Release /p:TestNativeAot=true -test -maxcpucount:10

The failure is not specific to linux-arm64

win-x64 repro:

build.cmd -s clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime+libs+libs.tests -rc Checked -lc Release /p:TestNativeAot=true -test --maxcpucount:16

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions