Repository navigation
NullReferenceException inside ConcurrentDictionary.GrowTable #69192
Copy link
Copy link
Closed
Labels
Milestone
Description
Pipeline: https://dev.azure.com/dnceng/public/_build/results?buildId=1764865&view=results
Job: Installer Build and Test coreclr Linux_arm Release
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : Error: Object reference not set to an instance of an object. [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : System.NullReferenceException: Object reference not set to an instance of an object. [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at System.Collections.Concurrent.ConcurrentDictionary`2.GrowTable(Tables tables) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at System.Collections.Concurrent.ConcurrentDictionary`2.TryAddInternal(TKey key, Nullable`1 nullableHashcode, TValue value, Boolean updateIfExists, Boolean acquireLock, TValue& resultingValue) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.DependencyAnalysis.NodeCache`2.GetOrAdd(TKey key) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.DependencyAnalysis.NodeFactory.CompiledMethodNode(MethodDesc method) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.Compilation.RootingServiceProvider.AddCompilationRoot(MethodDesc method, Boolean rootMinimalDependencies, String reason) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.ReadyToRunRootProvider.RootMethods(TypeDesc type, String reason, IRootingServiceProvider rootProvider) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.ReadyToRunRootProvider.AddCompilationRoots(IRootingServiceProvider rootProvider) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.Compilation..ctor(DependencyAnalyzerBase`1 dependencyGraph, NodeFactory nodeFactory, IEnumerable`1 compilationRoots, ILProvider ilProvider, DevirtualizationManager devirtualizationManager, IEnumerable`1 modulesBeingInstrumented, Logger logger, InstructionSetSupport instructionSetSupport) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.ReadyToRunCodegenCompilation..ctor(DependencyAnalyzerBase`1 dependencyGraph, NodeFactory nodeFactory, IEnumerable`1 roots, ILProvider ilProvider, Logger logger, DevirtualizationManager devirtualizationManager, IEnumerable`1 inputFiles, String compositeRootPath, InstructionSetSupport instructionSetSupport, Boolean resilient, Boolean generateMapFile, Boolean generateMapCsvFile, Boolean generatePdbFile, Func`2 printReproInstructions, String pdbPath, Boolean generatePerfMapFile, String perfMapPath, Int32 perfMapFormatVersion, Boolean generateProfileFile, Int32 parallelism, ProfileDataManager profileData, ReadyToRunMethodLayoutAlgorithm methodLayoutAlgorithm, ReadyToRunFileLayoutAlgorithm fileLayoutAlgorithm, Int32 customPESectionAlignment, Boolean verifyTypeAndFieldLayout) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.ReadyToRunCodegenCompilationBuilder.ToCompilation() [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.Program.Run(String[] args) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.Program.Main(String[] args) [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]
/root/runtime/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(351,5): error NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. [/root/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.Composite.sfxproj]@jkotas do you think this could also be a symptom of #68443?
Reactions are currently unavailable
Activity
jkotas commentedon May 11, 2022
It can be a symptom of #68443. It is hard to tell with any level of confidence without a crash dump.
jakobbotsch commentedon May 13, 2022
Another similar-looking-but-not-quite example in #69068:
Pipeline run: https://dev.azure.com/dnceng/public/_build/results?buildId=1769350&view=results
Job name: Build windows x64 debug NativeAOT
VincentBu commentedon May 27, 2022
Failed again in: runtime-coreclr outerloop 20220526.2
Failed test:
Error message:
AaronRobinsonMSFT commentedon Jun 14, 2022
Failed in #70251
nerai commentedon Jun 17, 2022
I have a more or less reproducible crash attached. Is this related?
I'm on .NET 6.0, VS 2022.
This is the line. The visible IP is in two lines below, probably because it is optimized.
Seems to happen at large item counts (Count = 94644926).
I verified it is not related to exhaustion of physical RAM.
I don't see which value exactly is null.
As far as I can tell this occurs even when no second thread is currently holding a lock.
Update
The linked list had a length of 42 before
nextturned intoUnable to read memory.I could reproduce this scenario precisely.
When I replaced the hash function with a better one, the problem disappeared.
trylek commentedon Jun 20, 2022
I'm wondering whether this might be related to #66079 - in this issue we're observing unbounded growth of certain dictionaries due to the generic explosion, at one point I observed 32-bit integer wraparound that might theoretically explain the nullref. I continue working on the fix for 66079 with the hope that this may go away once it's available.
AntonLapounov commentedon Aug 12, 2022
@nerai I do not see the repro attached. Could you please share it?
nerai commentedon Aug 12, 2022
Sorry, I worded that poorly. The crash was reproducible, but it was part of a large in-prod project. It took hours/days to manifest during runtime, so it's not easy to create a separate project that I could share here.
mangod9 commentedon Aug 24, 2022
Hi @nerai, would you be able to share a few dumps of the failure so we could investigate further? Thanks
AntonLapounov commentedon Sep 6, 2022
No repro since June 18th?
mangod9 commentedon Sep 6, 2022
Ok to close then and re-evaluate if it shows up again.