Skip to content

ILLinker NRE on Windows #69536

Closed
Closed

Description

@radical

Build:

ILLink : error IL1012: IL Trimmer has encountered an unexpected error. Please report the issue at https://github.com/dotnet/linker/issues [D:\a\_work\1\s\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
##[error]ILLink(0,0): error IL1012: (NETCORE_ENGINEERING_TELEMETRY=Build) IL Trimmer has encountered an unexpected error. Please report the issue at https://github.com/dotnet/linker/issues
  Fatal error in IL Linker
  Unhandled exception. Mono.Linker.InternalErrorException: Step 'OutputStep' failed when processing assembly 'System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
   ---> Mono.Linker.LinkerFatalErrorException: ILLink: error IL1011: Failed to write 'D:\a\_work\1\s\artifacts\obj\coreclr\System.Private.CoreLib\x86\Debug\System.Private.CoreLib.dll'.
   ---> System.NullReferenceException: Object reference not set to an instance of an object.
     at Mono.Cecil.PE.ByteBufferEqualityComparer.Equals(ByteBuffer x, ByteBuffer y)
     at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
     at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
     at Mono.Cecil.Metadata.BlobHeapBuffer.GetBlobIndex(ByteBuffer blob)
     at Mono.Cecil.MetadataBuilder.GetBlobIndex(ByteBuffer blob)
     at Mono.Cecil.MetadataBuilder.GetBlobIndex(Byte[] blob)
     at Mono.Cecil.MetadataBuilder.AddCustomDebugInformations(ICustomDebugInformationProvider provider)
     at Mono.Cecil.MetadataBuilder.AddMethodDebugInformation(MethodDebugInformation method_info)
     at Mono.Cecil.Cil.PortablePdbWriter.Write(MethodDebugInformation info)
     at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
     at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
     at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
     at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
     at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
     at Mono.Cecil.MetadataBuilder.AddTypes()
     at Mono.Cecil.MetadataBuilder.BuildTypes()
     at Mono.Cecil.MetadataBuilder.BuildModule()
     at Mono.Cecil.MetadataBuilder.BuildMetadata()
     at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
     at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
     at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
     at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
     at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
     at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
     at Mono.Cecil.AssemblyDefinition.Write(String fileName, WriterParameters parameters)
     at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
     --- End of inner exception stack trace ---
     at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters)
     at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory)
     at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly)
     at Mono.Linker.Steps.OutputStep.ProcessAssembly(AssemblyDefinition assembly)
     at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
     --- End of inner exception stack trace ---
     at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
     at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
     at Mono.Linker.Pipeline.Process(LinkContext context)
     at Mono.Linker.Driver.Run(ILogger customLogger, Boolean throwOnFatalLinkerException)
     at Mono.Linker.Driver.Main(String[] args)
Build Kind Start Time
1813081 Rolling 2022-08-06
1814339 Rolling 2022-08-06

Activity

  1. added
    blocking-clean-ci
    linkable-framework
    on May 19, 2022
  2. ghost added
    untriaged
    on May 19, 2022
  3. removed
    untriaged
    on May 19, 2022
  4. radical commented on May 20, 2022

    @radical
    MemberAuthor
  5. eerhardt commented on May 20, 2022

    @eerhardt
    Member

    @radical - has this happened on any other build than your PR? Does it repro in main? If yes - do you have repro steps on what kind of build, and on what platform, this repros on?

  6. radical commented on May 20, 2022

    @radical
    MemberAuthor

    No, I have seen it only this one time.

  7. eerhardt commented on May 20, 2022

    @eerhardt
    Member

    No, I have seen it only this one time.

    Are you sure the failure isn't caused by your changes? Can you repro it yourself with your changes?

  8. radical commented on May 20, 2022

    @radical
    MemberAuthor

    It passed on the second attempt by azdo for the same commit of my branch. My PR has very few non-wasm specific changes, and this is not for a wasm run.

  9. eerhardt commented on May 20, 2022

    @eerhardt
    Member

    Hmm, that's odd for a NRE in the linker to be non-deterministic. @agocke @vitek-karas @sbomer - thoughts?

  10. 7 remaining items

  11. lewing commented on Jun 3, 2022

    @lewing
    Member

    Do we have a working theory for what is causing these?

  12. radical commented on Jun 3, 2022

    @radical
    MemberAuthor

    The other recent linker exceptions - dotnet/linker#2789 , and #70031 .

  13. eerhardt commented on Jun 3, 2022

    @eerhardt
    Member

    Or a way to get a trace dump so someone can investigate? Has anyone been able to repro this outside of CI?

  14. vitek-karas commented on Jun 3, 2022

    @vitek-karas
    Member

    As far as I know we haven't seen this outside of CI - and it's not very common in CI either (less than once a day). The current theory is that it's related to #68443.
    For example here is a similar failure in crossgen2 (similar as in relatively random NRE): #69192

    Problem is that crossgen2 and linker both run on the runtime which comes with the SDK and not with the runtime which is live built. So even though the possible cause of this has been fixed for a while, it can still show up for the tools.

    As for the crash dump - we have discussed this a little, but I'll continue that discussion today. Right now I don't think we have a way to get a crash dump of these failures from the CI. And even locally it will be hard - it's an exception which is handled by the process, so one would have to run it under debugger to catch this.

  15. lewing commented on Jun 3, 2022

    @lewing
    Member

    So to clarify, it looks like we're waiting on #70117 which @ViktorHofer would prefer not to land until p5 is officially released? How much confidence do we have that the fixes in p5 will resolve the issues?

  16. maraf commented on Jun 7, 2022

    @maraf
    Member

    Another one on #20220603.2

    Mono.Linker.LinkerFatalErrorException: /_/src/libraries/System.Private.CoreLib/src/System/IO/File.cs(112,17): error IL1005: System.IO.File.Exists(String): Error processing method 'System.IO.FileSystem.FileExists(ReadOnlySpan<Char>)' in assembly 'System.Private.CoreLib.dll'.
       ---> System.NullReferenceException: Object reference not set to an instance of an object.
         at Mono.Linker.Steps.MarkStep.IsMethodNeededByInstantiatedTypeDueToPreservedScope(MethodDefinition method)
         at Mono.Linker.Steps.MarkStep.GetRequiredMethodsForInstantiatedType(TypeDefinition type)+MoveNext()
         at Mono.Linker.Steps.MarkStep.MarkRequirementsForInstantiatedTypes(TypeDefinition type)
         at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
         at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
         at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, MessageOrigin& origin)
         at Mono.Linker.Steps.MarkStep.ProcessQueue()
         --- End of inner exception stack trace ---
         at Mono.Linker.Steps.MarkStep.ProcessQueue()
         at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
         at Mono.Linker.Steps.MarkStep.Process()
         at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
         at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
         at Mono.Linker.Pipeline.Process(LinkContext context)
         at Mono.Linker.Driver.Run(ILogger customLogger, Boolean throwOnFatalLinkerException)
    
    
  17. mangod9 commented on Jun 7, 2022

    @mangod9
    Member

    This doesnt appear to be the potential GC issue. @radical, Is there a dump available to look at?

  18. radical commented on Jun 7, 2022

    @radical
    MemberAuthor

    This doesnt appear to be the potential GC issue. @radical, Is there a dump available to look at?

    I don't see one. Maybe @vitek-karas has an answer (ref: #69536 (comment)).

  19. agocke commented on Jun 7, 2022

    @agocke
    Member

    AFAIK this is only happening in builds, and we don't collect crash dumps on build machines. However, we should change the linker to stop swallowing exceptions, dotnet/linker#2824

  20. agocke commented on Jun 17, 2022

    @agocke
    Member

    If this was a GC hole, as we suspected, then Preview 5 is merged and this shouldn't happen anymore. Closing until we see new faliures.

  21. ghost locked as resolved and limited conversation to collaborators on Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-VM-coreclrblocking-clean-cilinkable-framework

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions