-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[AOT publish error] EXEC : error : Arithmetic operation resulted in an overflow. #97235
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsDescriptionI created a new AOT minimal API project using the template available in VS22 and then added just a couple routes that reference a subsection of a mature code base. This builds and runs from debugger. When I try to publish using This project does use LanguageExt which does use a ton of generics for the functional monads. But I don't think there is a circular generic cycle as mentioned by Jkotas.
Originally posted by @jkotas in #66787 (comment) Any tips on tools or automated methods for searching for a cycle? Ideally the error message from compiler would recognize problem and say its not supported if that is truly the case. Reproduction StepsCannot provide example at this moment as my specific case involves proprietary code. But I imagine heavy use of generics from LanguageExt library is related. Expected behaviorNative assembly is generated from publish step or an error indicating generic cycle was detected if that is the true cause that cannot be supported. Actual behaviorSystem.OverflowException: Arithmetic operation resulted in an overflow. Regression?No response Known WorkaroundsNo response ConfigurationSDK: 8.0.101 64 bit Other informationNo response
|
Would it be possible to at least share the *.ilc.rsp file (you can find it under obj directory after publishing? I want to see if there's some trimming misconfiguration. You can censor out file paths or sensitive assembly names if there are any (replace them with Asm1/Asm2/...).
LanguageExt is known to have problems with AOT in .NET:
Don't know the status with PublishAot (this is the first report), but I'm not optimistic based on the above. Some libraries simply won't work with AOT because they're built around having a JIT and being able to compile unbounded numbers of native method bodies.
Usually there are IL3054 warnings for this. Are there none in the output before the crash? Could be that this is so pathologic that we ran out of memory before cutoffs are hit. |
Sure thing Michal, Here is ilc.rsp (.txt added for github). I noticed at the end of it it seems like multiple I did see warnings about AOT analysis and trimming. But I admit I kinda forgot about them when the error looked like an internal error and didn't indicate immediate relation to the warnings. here is a snippet from the output.
I will look at the language ext issues more closely. But this does have me curious, does F# have similar problems with AOT with all its generics? |
I also just realized I never reported this part of the error (sorry!) but now seems relavant to ilc.rsp files. This is the very last line after the stack trace.
|
Thanks! It seems like the project is configured correctly (I wanted to double check it's not the same issue as #66787). It really just results in a extremely big native compilation. If the compiler didn't fail here, it would probably still compile forever because we're taking hundreds of millions of methods and it was not done yet when it hit limits. Typical larger app will have tens of thousands of methods. |
I think this is a generic cycle that is similar to the one seen in #99409. You should be able to at least get more information by adding I expect you'll see AOT warnings. If you add If there is a cycle, there's not much we can do. |
Thanks for the tip Michal, unfortunately we have since pivoted and I won't be able to go back to try it out. But we still use C# a lot and I do use LanguageExt plenty so its possible we will hit this again and will need to look that argument to diagnose. Until then I will close this. |
Description
I created a new AOT minimal API project using the template available in VS22 and then added just a couple routes that reference a subsection of a mature code base. This builds and runs from debugger. When I try to publish using
dotnet publish project.csproj -r win-x64 -c Release
I get an internal compiler error below. It looks related and very similar to #66787.This project does use LanguageExt which does use a ton of generics for the functional monads. But I don't think there is a circular generic cycle as mentioned by Jkotas.
Originally posted by @jkotas in #66787 (comment)
Any tips on tools or automated methods for searching for a cycle? Ideally the error message from compiler would recognize problem and say its not supported if that is truly the case.
Reproduction Steps
Cannot provide example at this moment as my specific case involves proprietary code. But I imagine heavy use of generics from LanguageExt library is related.
Expected behavior
Native assembly is generated from publish step or an error indicating generic cycle was detected if that is the true cause that cannot be supported.
Actual behavior
System.OverflowException: Arithmetic operation resulted in an overflow.
at Internal.Runtime.CompilerHelpers.ThrowHelpers.ThrowOverflowException() + 0x24
at Internal.TypeSystem.LockFreeReaderHashtable
2.Expand(TValue[]) + 0x3b at Internal.TypeSystem.LockFreeReaderHashtable
2.AddOrGetExistingInner(TValue, Boolean&) + 0x52at Internal.TypeSystem.LockFreeReaderHashtable
2.CreateValueAndEnsureValueIsInTable(TKey) + 0x26 at Internal.TypeSystem.InstantiatedType.<GetMethods>d__22.MoveNext() + 0x134 at ILCompiler.UsageBasedMetadataManager.GetConditionalDependenciesDueToEETypePresence(List
1&, NodeFactory, TypeDesc) + 0x853at ILCompiler.DependencyAnalysis.EETypeNode.GetConditionalStaticDependencies(NodeFactory) + 0x189c
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer
2.GetStaticDependenciesImpl(DependencyNodeCore
1) + 0xf3at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer
2.GetStaticDependencies(DependencyNodeCore
1) + 0x2bat ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer
2.ProcessMarkStack() + 0xb5 at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer
2.ComputeMarkedNodes() + 0x50at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x14
at ILCompiler.Program.g__RunScanner|4_0(Program.<>c__DisplayClass4_0&) + 0x191
at ILCompiler.Program.Run() + 0x2444
at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass221_0.<.ctor>b__0(ParseResult result) + 0x315
Regression?
No response
Known Workarounds
No response
Configuration
SDK: 8.0.101 64 bit
Windows 10 22H2 64 bit
TargetFramework: 8.0-windows
Other information
No response
The text was updated successfully, but these errors were encountered: