Skip to content

System.Text.Json.SourceGeneration.UnitTests.GeneratorTests failing with OutOfMemoryException on net7.0-windows-Release-x86-CoreCLR_checked-Windows.10.Amd64.Open #71962

Closed

Description

@jtschuster

Affects:

  • System.Text.Json.SourceGeneration.UnitTests.GeneratorTests
  • System.Text.Json.SourceGeneration.UnitTests.JsonSourceGeneratorDiagnosticsTests

Official run failures are typically on net7.0-windows-Release-x86-CoreCLR_checked-Windows.10.Amd64.Open

Frequency 4/20-8/5 (incl. PRs from Kusto):

Day Run Notes
7/31 JIT stress 28x failures
7/30 Rolling run 2x failures
7/30 JIT stress 96x failures
7/28 JIT stress 1x failure
7/28 JIT stress 42x failures
7/27 Rolling run 20x failures
7/12 JIT stress 12x failures
7/11 Rolling run 18x failures -- (12x at 9:08am + 6x at 3:48am)
7/11 JIT stress 18x failures
7/10 JIT stress 36x failures
7/9 JIT stress 12x failures
7/8 Rolling run 12x failures
7/8 JIT stress 24x failures
7/8 JIT stress - PR #71707 36x failures
7/7 JIT stress 24x failures
7/7 JIT stress - PR #71455 24x failures
let failedTests = (testNameSubstring : string, methodName : string, includePR : bool, messageSubstr: string, includePassedOnRerun : bool) {
cluster('engsrvprod.kusto.windows.net').database('engineeringdata').AzureDevOpsTests
    | where TestName contains testNameSubstring
    | where includePassedOnRerun or (Outcome == 'Failed')
    | extend startOfTestName = indexof_regex(TestName, @"[^.]+$")
    | extend Method = substring(TestName, startOfTestName)
    | extend Type = substring(TestName, 0, startOfTestName - 1)
    | project-away startOfTestName
    | where (methodName == '') or (Method == methodName)
    | where Message contains messageSubstr
    | distinct JobId, WorkItemId, Message, StackTrace, Method, Type, Arguments, Outcome
    | join kind=inner (cluster('engsrvprod.kusto.windows.net').database('engineeringdata').Jobs
        | where ((Branch == 'refs/heads/main') or (Branch == 'refs/heads/master') or (includePR and (Source startswith "pr/")))
        | where Type startswith "test/functional/cli/"
            and not(Properties contains "runtime-staging")
        | summarize arg_max(Finished, Properties, Type, Branch, Source, Started, QueueName) by JobId
        | project-rename JobType = Type) on JobId
    | extend PropertiesJson = parse_json(Properties)
    | extend OS = replace_regex(tostring(PropertiesJson.operatingSystem), @'\((.*)\).*|([^\(].*)', @'\1\2')
    | extend Runtime = iif(PropertiesJson.runtimeFlavor == "mono", "Mono", iif(PropertiesJson.DefinitionName contains "coreclr", "CoreCLR", ""))
    | extend TargetBranch = extractjson("$.['System.PullRequest.TargetBranch']", Properties)
    | extend Architecture = PropertiesJson.architecture
    | extend Scenario = iif(isempty(PropertiesJson.scenario), "--", PropertiesJson.scenario)
    //| extend DefinitionName = PropertiesJson.DefinitionName
    | project-away PropertiesJson
};
failedTests('System.Text.Json.SourceGeneration.UnitTests', '', true, 'OutOfMemoryException', true);
  • 7/22 Runfo report - only 3 builds affected in last 60 days (incl. PRs), with total of 30 test failures (2 failures are dupes):

Query, Log

Starting:    System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests (parallel test collections = on, max threads = 4)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.TestMultipleDefinitions [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(705,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.TestMultipleDefinitions()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.TypeDiscoveryWithRenamedAttribute [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(125,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateReferencedLocationCompilation()
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(166,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.TypeDiscoveryWithRenamedAttribute()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.RecordInExternalAssembly [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(451,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateReferencedLibRecordCompilation()
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(519,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.RecordInExternalAssembly()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.NoWarningsDueToObsoleteMembers [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(741,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.NoWarningsDueToObsoleteMembers()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.RecordDerivedFromRecordInExternalAssembly [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(478,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateReferencedSimpleLibRecordCompilation()
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(565,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.RecordDerivedFromRecordInExternalAssembly()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.CollectionDictionarySourceGeneration [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(181,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateReferencedHighLowTempsCompilation()
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(348,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.CollectionDictionarySourceGeneration()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.NoErrorsWhenUsingIgnoredReservedCSharpKeywords [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(801,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.NoErrorsWhenUsingIgnoredReservedCSharpKeywords()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(assemblyName: "System.Text.Json", includeSTJ: True) [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(277,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(String assemblyName, Boolean includeSTJ)
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(assemblyName: "System.Text.Json.Not", includeSTJ: True) [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(277,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(String assemblyName, Boolean includeSTJ)
           at InvokeStub_GeneratorTests.LocalJsonSerializableAttributeExpectedShape(Object, Object, IntPtr*)
           at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(assemblyName: "System.Text.Json", includeSTJ: False) [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(277,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(String assemblyName, Boolean includeSTJ)
           at InvokeStub_GeneratorTests.LocalJsonSerializableAttributeExpectedShape(Object, Object, IntPtr*)
           at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(assemblyName: "System.Text.Json.Not", includeSTJ: False) [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(277,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(String assemblyName, Boolean includeSTJ)
           at InvokeStub_GeneratorTests.LocalJsonSerializableAttributeExpectedShape(Object, Object, IntPtr*)
           at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.ContextTypeNotInNamespace [FAIL]
      System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs(135,0): at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs(94,0): at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size)
        /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs(167,0): at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size)
           at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs(37,0): at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs(428,0): at System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.ContextTypeNotInNamespace()
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(74,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
  Finished:    System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests

Activity

  1. added
    blocking-clean-ci
    untriaged
    on Jul 11, 2022
  2. krwq commented on Jul 12, 2022

    @krwq
    Member

    is this consistent repro? this looks more like something wrong with machine rather than JSON

  3. krwq commented on Jul 12, 2022

    @krwq
    Member

    @jakobbotsch this seems like it happened in the same run 2min apart from each other (7/11/2022, 10:18:42 AM & 7/11/2022, 10:16:39 AM) but machines do in fact look like they're different: a000XKI & a000XJR. I'm curious if there was some external factor perhaps.

    I'd be interested in seeing if we have more instances of this before investigating.

  4. jakobbotsch commented on Jul 12, 2022

    @jakobbotsch
    Member

    libraries-jitstress runs many scenarios (different environment variables) and triggers multiple helix job runs simultaneously, so it is not surprising that the timestamps are close to each other since indeed the pipeline run that triggered them is the same.

  5. jakobbotsch commented on Jul 12, 2022

    @jakobbotsch
    Member

    I do see pretty significant memory usage in this test when running it locally:
    image

  6. added this to the 7.0.0 milestone on Jul 12, 2022
  7. ghost removed
    untriaged
    on Jul 12, 2022
  8. krwq commented on Jul 12, 2022

    @krwq
    Member

    we should either fix memory consumption or disable memory heavy test cases in 7.0

  9. eiriktsarpalis commented on Jul 12, 2022

    @eiriktsarpalis
    Member

    Since this concerns unit testing for the source generator, wonder whether this could be related #71653

    cc @CyrusNajmabadi

  10. danmoseley commented on Jul 14, 2022

    @danmoseley
    Contributor

    Is it important to run the generator tests on a checked runtime? If not why not just disable them [SkipOnCoreClr("Uses too much memory", ~RuntimeConfiguration.Release)] on each class. It looks like it might work on the whole assembly if you need it to.

  11. 1 remaining item

  12. removed
    blocking-clean-ci
    on Jul 22, 2022
  13. karelz commented on Jul 22, 2022

    @karelz
    Member

    Actually, Kusto shows more failures -- see updated top post. Adding the label back.
    If it does not happen again for 1-2 weeks, we can remove it again.

  14. added
    blocking-clean-ci
    on Jul 22, 2022
  15. VincentBu commented on Jul 28, 2022

    @VincentBu
    Contributor

    Failed again in: runtime-coreclr libraries-jitstress 20220727.1

    Failed test:

    net7.0-windows-Release-x86-CoreCLR_checked-jitminopts-Windows.10.Amd64.Open
    - System.Text.Json.SourceGeneration.UnitTests.JsonSourceGeneratorDiagnosticsTests.UnsuccessfulSourceGeneration
    
    net7.0-windows-Release-x86-CoreCLR_checked-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeUnexpectedShape(assemblyName: \"System.Text.Json.Not\", includeSTJ: False)
    
    net7.0-windows-Release-x86-CoreCLR_checked-jitstress1-Windows.10.Amd64.Open
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeUnexpectedShape(assemblyName: \"System.Text.Json.Not\", includeSTJ: False)
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.TypeDiscoveryWithRenamedAttribute
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.RecordDerivedFromRecordInExternalAssembly
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.RecordInExternalAssembly
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.TestMultipleDefinitions
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(assemblyName: \"System.Text.Json.Not\", includeSTJ: False)
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(assemblyName: \"System.Text.Json\", includeSTJ: False)
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(assemblyName: \"System.Text.Json.Not\", includeSTJ: True)
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.LocalJsonSerializableAttributeExpectedShape(assemblyName: \"System.Text.Json\", includeSTJ: True)
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.CollectionDictionarySourceGeneration
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.ContextTypeNotInNamespace
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.NoWarningsDueToObsoleteMembers
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.NoErrorsWhenUsingIgnoredReservedCSharpKeywords
    
    net7.0-windows-Release-x86-CoreCLR_checked-jitstress2-Windows.10.Amd64.Open
    - System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.TypeDiscoveryPrimitiveExternalPOCO
    

    Error message:

    System.OutOfMemoryException : Insufficient memory to continue the execution of the program.
    
    
    Stack trace
       at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Windows.cs:line 135
       at System.Runtime.InteropServices.Marshal.AllocHGlobal(Int32 cb) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs:line 31
       at System.Reflection.Internal.NativeHeapMemoryBlock.DisposableData..ctor(Int32 size) in /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/NativeHeapMemoryBlock.cs:line 32
       at System.Reflection.Internal.NativeHeapMemoryBlock..ctor(Int32 size) in /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/NativeHeapMemoryBlock.cs:line 62
       at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Int64 start, Int32 size) in /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/StreamMemoryBlockProvider.cs:line 71
       at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size) in /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs:line 188
       at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options) in /_/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs:line 126
       at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options)
       at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(Stream peStream, String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
       at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
       at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateCompilation(String source, MetadataReference[] additionalReferences, String assemblyName, Boolean includeSTJ, Func`2 configureParseOptions) in /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs:line 38
       at System.Text.Json.SourceGeneration.UnitTests.CompilationHelper.CreateActiveOrUpcomingEventCompilation() in /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs:line 169
       at System.Text.Json.SourceGeneration.UnitTests.JsonSourceGeneratorDiagnosticsTests.<UnsuccessfulSourceGeneration>g__RunTest|2_0(Boolean explicitRef) in /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs:line 149
       at System.Text.Json.SourceGeneration.UnitTests.JsonSourceGeneratorDiagnosticsTests.UnsuccessfulSourceGeneration() in /_/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs:line 216
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
       at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs:line 64
    
  16. danmoseley commented on Jul 28, 2022

    @danmoseley
    Contributor

    We need to disable for chk CLR as suggested above

  17. jakobbotsch commented on Jul 31, 2022

    @jakobbotsch
    Member

    We are still hitting this on jit pipelines that run libraries tests frequently.
    For example, our latest weekend libraries-pgo run hit this 9 8 times in separate runs: https://dev.azure.com/dnceng/public/_build/results?buildId=1913659&view=ms.vss-test-web.build-test-results-tab

    Note that I believe the x86 host is not large address aware, so the 1.8 GB memory usage in my screenshot above is quite close to the 2.1 GB limit on x86.

  18. danmoseley commented on Jul 31, 2022

    @danmoseley
    Contributor

    @krwq what do you propose here?

  19. removed
    blocking-clean-ci
    on Aug 5, 2022
  20. karelz commented on Aug 5, 2022

    @karelz
    Member

    Removing 'blocking-clean-ci' - the tests were disabled on non-Release runs in PR #73181

  21. modified the milestones: 7.0.0, Future on Aug 9, 2022
  22. ghost added
    in-pr
    on Feb 28, 2024
  23. ghost removed
    in-pr
    on Feb 29, 2024
  24. locked and limited conversation to collaborators on Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions