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

ILT0005 Out of memory when building release mode #9

Open
20 tasks
Arlodotexe opened this issue Jul 29, 2022 · 9 comments
Open
20 tasks

ILT0005 Out of memory when building release mode #9

Arlodotexe opened this issue Jul 29, 2022 · 9 comments
Assignees
Labels
bug 🐛 Something isn't working CI/pipeline 🔬

Comments

@Arlodotexe
Copy link
Member

Arlodotexe commented Jul 29, 2022

Describe the bug

Here goes nothing.

In the CI, we've hit ILT0005, and an out of memory error. Only WinUI 2 failed to build, and no app-affecting code was changed for this CI run.

error : ILT0005: 'C:\Users\runneradmin\.nuget\packages\runtime.win10-x64.microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\x64\ilc\Tools\nutc_driver.exe @"D:\a\Labs-Windows\Labs-
error : Error: NUTC300F:Internal Compiler Error: Native compilation failed due to out of memory error 

I've seen this before - I've been having this issue in a project's CI for several months, and I've already spent 2 weeks researching and trying to fix this error.

This is the first time I've seen it happen in Labs, but if this is related, then it's more or less random and only present on mid to low-spec machines. It's not reproducible in a VM and it's going to happen more frequently the more code we put into Labs.

There are some mitigations that we can try anyway, but I'm not expecting it to be that easy.

Steps to reproduce

See https://github.com/CommunityToolkit/Labs-Windows/runs/7550122176?check_suite_focus=true

Expected behavior

A buildable repo should consistently pass CI

Screenshots

image

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Additional context

No response

Help us help you

Yes, but only if others can assist.

@michael-hawker
Copy link
Member

For CommunityToolkit/Labs-Windows#211 it was just a general exit code, but it may be the same thing. The guidance from the threads in dotnet/corert#5604 was to turn the 64-bit mode on for .NET Native. I tried that in CommunityToolkit/Labs-Windows#211 but then I think it causes issues with all the MSTest warnings we have about something that's misconfigured there.

Did you want to try just bringing over 92ecbc47988d76bc1057e96fda413a80f9abf6ce in a separate branch and seeing if you can add the missing dependencies (if that's the issue) to the test projects?

"D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj" (default target) (14:6) ->
  C:\Users\runneradmin\.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : Internal Compiler Error [D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj]
  C:\Users\runneradmin\.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : Type 'System.Xml.XmlDocumentXPathExtensions' from assembly 'System.Xml.XPath.XmlDocument' was not included in compilation, but was referenced in method 'ClientUtilities.FixRelativePathsInRunSettings(XmlDocument, string)'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj]
  C:\Users\runneradmin\.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : Method 'ClientUtilities.FixRelativePathsInRunSettings(XmlDocument, string)' will always throw an exception due to the missing method 'XmlDocumentXPathExtensions.SelectSingleNode(XmlNode, string)' in assembly 'System.Xml.XPath.XmlDocument'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj]
  C:\Users\runneradmin\.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : Method 'InferRunSettingsHelper.MakeRunsettingsCompatible(string)' will always throw an exception due to the missing method 'XmlDocumentXPathExtensions.CreateNavigator(XmlDocument)' in assembly 'System.Xml.XPath.XmlDocument'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj]
  C:\Users\runneradmin\.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : Method 'InferRunSettingsHelper.UpdateRunSettingsWithUserProvidedSwitches(XmlDocument, Architecture, Framework, string)' will always throw an exception due to the missing method 'XmlDocumentXPathExtensions.CreateNavigator(XmlDocument)' in assembly 'System.Xml.XPath.XmlDocument'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj]
  C:\Users\runneradmin\.nuget\packages\microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\Microsoft.NetNative.targets(805,5): error : Method 'InferRunSettingsHelper.TryGetLegacySettingElements(string, Dictionary<string, string>)' will always throw an exception due to the missing method 'XmlDocumentXPathExtensions.CreateNavigator(XmlDocument)' in assembly 'System.Xml.XPath.XmlDocument'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. [D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj]

https://github.com/CommunityToolkit/Labs-Windows/runs/7735671450?check_suite_focus=true#step:9:16694

@Arlodotexe
Copy link
Member Author

Arlodotexe commented Aug 10, 2022

@michael-hawker In case it helps, we discovered and applied a number of fixes in here (different project) that we could try.

@michael-hawker
Copy link
Member

Also see Sergio's comment here: CommunityToolkit/Labs-Windows#290 (comment)

@Arlodotexe
Copy link
Member Author

Arlodotexe commented Oct 27, 2022

@michael-hawker This is one of the fixes I intended to try when I got time.

From here, any one of these could help us mitigate the error for now:

    <Use64BitCompiler>true</Use64BitCompiler>
    <PreferredToolArchitecture>x64</PreferredToolArchitecture>

    <SingleThreadNUTC>true</SingleThreadNUTC>
    <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
    <EnableGatekeeperAnalysis>true</EnableGatekeeperAnalysis>
    <ShortcutGenericAnalysis>true</ShortcutGenericAnalysis> <!-- Can help stop runaway analysis of generic types and reduce overall generation requirements. -->
    <OutOfProcPDB>true</OutOfProcPDB> <!-- Opt-in to generate PDB's out of process -->

From past experience with this bug, I don't expect any of these to solve the problem permanently, but we can try them.

@Arlodotexe Arlodotexe self-assigned this Nov 10, 2022
@Arlodotexe
Copy link
Member Author

Arlodotexe commented Nov 17, 2022

In CommunityToolkit/Labs-Windows#211, we managed to make ILT0005 happen on every CI run. After investigating, we found:

[View CI run] ILT0005 happens every time when <Use64BitCompiler> is applied to main equivalent.
[View CI run] ILT0005 only happens occasionally when <Use64BitCompiler> is removed.

@michael-hawker
Copy link
Member

@Arlodotexe <Use64BitCompiler> was added afterwards to try and resolve the error though...

@Arlodotexe
Copy link
Member Author

Arlodotexe commented Nov 18, 2022

@Arlodotexe <Use64BitCompiler> was added afterwards to try and resolve the error though...

ILT0005 is an out of memory error, it could be that using the 64 bit compiler increased the memory used beyond the 4GB limit on 32-bit processes and caused the error to happen more often.

@michael-hawker
Copy link
Member

Hitting this a ton on CommunityToolkit/Labs-Windows#405, thought we had some of the flags enabled, but don't see them.

From @Sergio0694:

<Use64BitCompiler>true</Use64BitCompiler> and <OutOfProcPDB>true</OutOfProcPDB>
These can help a bit. Need .NET Native 6.2.14 for the later

@Arlodotexe I think these caused other warnings to turn as errors at one point too which we had to resolve, but I'll try pushing a branch with just them enabled in the UWP props file and see what happens.

@Arlodotexe
Copy link
Member Author

Arlodotexe commented May 8, 2023

A workaround suggested by a member of the UWP Community (see here and here) seems to do what we need in the CI.

There are other variants of ILT0005 that can happen locally (involving PDB write errors), but these are no longer appearing in this project. We'll close this for now, if CommunityToolkit/Labs-Windows#431 passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working CI/pipeline 🔬
Projects
Status: 📋 Backlog
Status: No status
Development

No branches or pull requests

2 participants