Skip to content
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

[outerloop] [NativeAOT] Code generation failed for method System.Linq.Tests.EmptyPartitionTests.SingleInstance() #95367

Closed
carlossanlop opened this issue Nov 28, 2023 · 1 comment · Fixed by #95383
Labels
area-NativeAOT-coreclr blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs Known Build Error Use this to report build issues in the .NET Helix tab

Comments

@carlossanlop
Copy link
Member

carlossanlop commented Nov 28, 2023

Error Blob

{
  "ErrorMessage": "Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()",
  "BuildRetry": false,
  "ErrorPattern": "",
  "ExcludeConsoleLog": false
}

Reproduction Steps

@dotnet/ilc-contrib

...
Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Generating native code
  System.Net.WebSockets.Tests -> D:\a\_work\1\s\artifacts\bin\System.Net.WebSockets.Tests\Release\net9.0\publish\
  Zipping directory "D:\a\_work\1\s\artifacts\bin\System.Net.WebSockets.Tests\Release\net9.0\publish\" to "D:\a\_work\1\s\artifacts\helix\tests\windows.AnyCPU.Release\System.Net.WebSockets.Tests.zip".
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
EXEC : error : One or more errors occurred. (Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()') [D:\a\_work\1\s\src\libraries\System.Linq\tests\System.Linq.Tests.csproj]
##[error]EXEC(0,0): error : (NETCORE_ENGINEERING_TELEMETRY=Build) One or more errors occurred. (Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()')
  System.AggregateException: One or more errors occurred. (Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()')
   ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()'
   ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
     at Internal.JitInterface.CorInfoImpl.recordRelocation(Void*, Void*, Void*, UInt16, Int32) + 0x1e1
     at Internal.JitInterface.CorInfoImpl._recordRelocation(IntPtr, IntPtr*, Void*, Void*, Void*, UInt16, Int32) + 0x54
     --- End of inner exception stack trace ---
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode, MethodIL) + 0x1de
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode, MethodIL) + 0x5f
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl, MethodCodeNode) + 0xa3
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(MethodCodeNode methodCodeNodeNeedingCode) + 0x88
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) + 0x1aa
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) + 0x4c7
     at System.Threading.Tasks.TaskReplicator.Replica.Execute() + 0x66
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.TaskReplicator.Run[TState](TaskReplicator.ReplicatableUserAction`1, ParallelOptions, Boolean) + 0x27a
     at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt, TInt, ParallelOptions, Action`1, Action`2, Func`4, Func`1, Action`1) + 0x286
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection, CancellationToken, Exception) + 0x30
     at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt, TInt, ParallelOptions, Action`1, Action`2, Func`4, Func`1, Action`1) + 0x450
     at ILCompiler.RyuJitCompilation.CompileMultiThreaded(List`1) + 0x1f9
     at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1 obj) + 0x15d
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x95
     at ILCompiler.RyuJitCompilation.CompileInternal(String, ObjectDumper) + 0x1f
     at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x61
     at ILCompiler.Program.Run() + 0x2854
     at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass221_0.<.ctor>b__0(ParseResult result) + 0x2ed
D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Release\build\Microsoft.NETCore.Native.targets(303,5): error MSB3073: The command ""D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Release\ilc-published\\ilc" @"D:\a\_work\1\s\artifacts\obj\System.Linq.Tests\Release\net9.0\native\System.Linq.Tests.ilc.rsp"" exited with code 1. [D:\a\_work\1\s\src\libraries\System.Linq\tests\System.Linq.Tests.csproj]
##[error]artifacts\bin\coreclr\windows.x64.Release\build\Microsoft.NETCore.Native.targets(303,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command ""D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Release\ilc-published\\ilc" @"D:\a\_work\1\s\artifacts\obj\System.Linq.Tests\Release\net9.0\native\System.Linq.Tests.ilc.rsp"" exited with code 1.

...

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=482959
Error message validated: Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 11/28/2023 11:46:12 PM UTC

Report

Build Definition Step Name Console log Pull Request
483389 dotnet/runtime Build product Log
483120 dotnet/runtime Build product Log
482959 dotnet/runtime Build product Log #94868

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
3 3 3
@carlossanlop carlossanlop added blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs area-NativeAOT-coreclr Known Build Error Use this to report build issues in the .NET Helix tab labels Nov 28, 2023
@ghost
Copy link

ghost commented Nov 28, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Error Blob

{
  "ErrorMessage": "Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()",
  "BuildRetry": false,
  "ErrorPattern": "",
  "ExcludeConsoleLog": false
}

Reproduction Steps

@dotnet/ilc-contrib

...
Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Generating native code
  System.Net.WebSockets.Tests -> D:\a\_work\1\s\artifacts\bin\System.Net.WebSockets.Tests\Release\net9.0\publish\
  Zipping directory "D:\a\_work\1\s\artifacts\bin\System.Net.WebSockets.Tests\Release\net9.0\publish\" to "D:\a\_work\1\s\artifacts\helix\tests\windows.AnyCPU.Release\System.Net.WebSockets.Tests.zip".
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
EXEC : error : One or more errors occurred. (Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()') [D:\a\_work\1\s\src\libraries\System.Linq\tests\System.Linq.Tests.csproj]
##[error]EXEC(0,0): error : (NETCORE_ENGINEERING_TELEMETRY=Build) One or more errors occurred. (Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()')
  System.AggregateException: One or more errors occurred. (Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()')
   ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[System.Linq.Tests]System.Linq.Tests.EmptyPartitionTests.SingleInstance()'
   ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
     at Internal.JitInterface.CorInfoImpl.recordRelocation(Void*, Void*, Void*, UInt16, Int32) + 0x1e1
     at Internal.JitInterface.CorInfoImpl._recordRelocation(IntPtr, IntPtr*, Void*, Void*, Void*, UInt16, Int32) + 0x54
     --- End of inner exception stack trace ---
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode, MethodIL) + 0x1de
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode, MethodIL) + 0x5f
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl, MethodCodeNode) + 0xa3
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(MethodCodeNode methodCodeNodeNeedingCode) + 0x88
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) + 0x1aa
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) + 0x4c7
     at System.Threading.Tasks.TaskReplicator.Replica.Execute() + 0x66
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.TaskReplicator.Run[TState](TaskReplicator.ReplicatableUserAction`1, ParallelOptions, Boolean) + 0x27a
     at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt, TInt, ParallelOptions, Action`1, Action`2, Func`4, Func`1, Action`1) + 0x286
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection, CancellationToken, Exception) + 0x30
     at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt, TInt, ParallelOptions, Action`1, Action`2, Func`4, Func`1, Action`1) + 0x450
     at ILCompiler.RyuJitCompilation.CompileMultiThreaded(List`1) + 0x1f9
     at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1 obj) + 0x15d
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x95
     at ILCompiler.RyuJitCompilation.CompileInternal(String, ObjectDumper) + 0x1f
     at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x61
     at ILCompiler.Program.Run() + 0x2854
     at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass221_0.<.ctor>b__0(ParseResult result) + 0x2ed
D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Release\build\Microsoft.NETCore.Native.targets(303,5): error MSB3073: The command ""D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Release\ilc-published\\ilc" @"D:\a\_work\1\s\artifacts\obj\System.Linq.Tests\Release\net9.0\native\System.Linq.Tests.ilc.rsp"" exited with code 1. [D:\a\_work\1\s\src\libraries\System.Linq\tests\System.Linq.Tests.csproj]
##[error]artifacts\bin\coreclr\windows.x64.Release\build\Microsoft.NETCore.Native.targets(303,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command ""D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Release\ilc-published\\ilc" @"D:\a\_work\1\s\artifacts\obj\System.Linq.Tests\Release\net9.0\native\System.Linq.Tests.ilc.rsp"" exited with code 1.

...
Author: carlossanlop
Assignees: -
Labels:

blocking-clean-ci, blocking-outerloop, area-NativeAOT-coreclr, Known Build Error

Milestone: -

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 28, 2023
MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this issue Nov 29, 2023
Fixes dotnet#95367.

Relevant part of the JitDump:

```
Using `if true` assertions from pred BB02
Assertions in: #1
fgMorphTree BB04, STMT00021 (before)
               [000070] DA---------                         *  STORE_LCL_VAR ubyte  V10 tmp9
               [000057] -----------                         \--*  CAST      int <- ubyte <- int
               [000006] -----------                            \--*  EQ        int
               [000004] -----------                               +--*  LCL_VAR   ref    V02 tmp1          (last use)
               [000055] H----------                               \--*  CNS_INT(h) ref     'Frozen EmptyPartition`1<Int32> object'

Assertion prop for index #1 in BB04:
               [000006] -----------                         *  EQ        int
GenTreeNode creates assertion:
               [000070] DA---+-----                         *  STORE_LCL_VAR ubyte  V10 tmp9
In BB04 New Local Constant Assertion: V10 == [0000000000000001], index = #2

fgMorphTree BB04, STMT00021 (after)
               [000070] DA---+-----                         *  STORE_LCL_VAR ubyte  V10 tmp9
               [000055] H----+-----                         \--*  CNS_INT(h) int
```

The JitDump is unfinished because the compiler crashes when trying to dump the last line. Clearly, the `CNS_INT` is no longer a handle at that point because we just bashed it to a constant 1.
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Nov 29, 2023
MichalStrehovsky added a commit that referenced this issue Nov 29, 2023
Fixes #95367.

Relevant part of the JitDump:

```
Using `if true` assertions from pred BB02
Assertions in: #1
fgMorphTree BB04, STMT00021 (before)
               [000070] DA---------                         *  STORE_LCL_VAR ubyte  V10 tmp9
               [000057] -----------                         \--*  CAST      int <- ubyte <- int
               [000006] -----------                            \--*  EQ        int
               [000004] -----------                               +--*  LCL_VAR   ref    V02 tmp1          (last use)
               [000055] H----------                               \--*  CNS_INT(h) ref     'Frozen EmptyPartition`1<Int32> object'

Assertion prop for index #1 in BB04:
               [000006] -----------                         *  EQ        int
GenTreeNode creates assertion:
               [000070] DA---+-----                         *  STORE_LCL_VAR ubyte  V10 tmp9
In BB04 New Local Constant Assertion: V10 == [0000000000000001], index = #2

fgMorphTree BB04, STMT00021 (after)
               [000070] DA---+-----                         *  STORE_LCL_VAR ubyte  V10 tmp9
               [000055] H----+-----                         \--*  CNS_INT(h) int
```

The JitDump is unfinished because the compiler crashes when trying to dump the last line. Clearly, the `CNS_INT` is no longer a handle at that point because we just bashed it to a constant 1.
@ghost ghost removed in-pr There is an active PR which will close this issue when it is merged untriaged New issue has not been triaged by the area owner labels Nov 29, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-NativeAOT-coreclr blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs Known Build Error Use this to report build issues in the .NET Helix tab
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant