Skip to content

GC.GetGeneration test fails under R2R with JitStressRegs=2 #132291

Closed

Description

@dhartglassMSFT

(from copilot):

GC.GetGeneration test fails under R2R with JitStressRegs=2

Build information

Configuration

  • OS: Azure Linux 3
  • Architecture: x64
  • Runtime configuration: Checked
  • ReadyToRun: Crossgen2 (RunCrossGen2=1)
  • JIT stress mode: DOTNET_JitStressRegs=2
  • Test run: R2R-CG2 linux x64 Checked jitstressregs2 @ AzureLinux.3.Amd64.Open

Failure

GC/API/GC/GetGeneration/GetGeneration.dll fails when run from the R2R-CG2 test suite with register stress enabled. The object test passes, but the array test observes generation 0 both before and after a full collection. The test expects the array's generation to increase.

Relevant Helix log:

+ export RunCrossGen2=1
+ RunCrossGen2=1

export DOTNET_JitStressRegs=2

03:34:03.426 Running test: GC/API/GC/GetGeneration/GetGeneration.dll
ObjectTest Passed!
0 0
arrayTest Failed!
failTest Passed!

Test for GetGeneration() FAILED!
Xunit.Sdk.EqualException: Assert.Equal() Failure: Values differ
Expected: 100
Actual:   1
   at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 102
   at Program.<<Main>$>g__TestExecutor26|0_27(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
03:34:03.645 Failed test: GC/API/GC/GetGeneration/GetGeneration.dll

Known Issue Error Message

DO NOT USE JSON BELOW IF THIS IS A BUILD BREAK otherwise build analysis will allow pull requests to merge that break the build worse. For a build break, do not use this issue form. Make a regular new issue.

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "Test for GetGeneration() FAILED!",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎
Result validation: ⚠️ Provided build not found. Provide a valid build in the "Build: 🔎" line.
Validation performed at: 10/15/2026 2:08:09 PM UTC

Report

Build Repository Test Pull Request
1637289 dotnet/runtime GC/API/GC/GetGeneration/GetGeneration.dll #135882

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
1 1 1

Activity

  1. dhartglassMSFT commented on Aug 13, 2026

    @dhartglassMSFT
    ContributorAuthor

    @janvorli I'm assuming that this issue is totally distinct from #131542 , since this run used jit stress modes and not the interpreter. Let me know if this is not the case.

  2. janvorli commented on Aug 17, 2026

    @janvorli
    Member

    @dhartglassMSFT you are right. The most likely reason for the failure is the same as for the GC.Collect and GC.Collect0 tests and the fix would be the same as #132076

  3. dhartglassMSFT commented on Aug 17, 2026

    @dhartglassMSFT
    ContributorAuthor

    Thanks Jan
    @kkokosa sending this your way then for an initial look, per Jan's pointer.

    Though I saw this did not fail on the latest pipeline run from this weekend.

  4. VincentBu commented on Aug 18, 2026

    @VincentBu
    Contributor

    Failed in: runtime-coreclr jitstress 20260816.1

    Failed tests:

    coreclr linux arm64 Checked jitstress1 @ AzureLinux.3.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    
    

    Error message:

    Assert.Equal() Failure: Values differ
    Expected: 100
    Actual:   1
    

    Stack trace:

       at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 102
       at Program.<<Main>$>g__TestExecutor23|0_24(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
    
  5. VincentBu commented on Sep 4, 2026

    @VincentBu
    Contributor

    This run doesn't set JitStressRegs. Please let me know if I need to create another issue for this.

    Failed in: runtime-coreclr jitstress 20260902.1

    Failed tests:

    coreclr linux arm64 Checked jitstress1_tiered @ AzureLinux.3.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    
    

    Error message:

    Assert.Equal() Failure: Values differ
    Expected: 100
    Actual:   1
    

    Stack trace:

       at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 102
       at Program.<<Main>$>g__TestExecutor23|0_24(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
    
  6. VincentBu commented on Sep 14, 2026

    @VincentBu
    Contributor

    Failed in: runtime-coreclr outerloop 20260912.2

    Failed tests:

    R2R-CG2 windows arm64 Checked no_tiered_compilation @ Windows.11.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    
    

    Error message:

    Assert.Equal() Failure: Values differ
    Expected: 100
    Actual:   1
    

    Stack trace:

    at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 102
       at Program.<<Main>$>g__TestExecutor23|0_24(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
    
  7. VincentBu commented on Sep 22, 2026

    @VincentBu
    Contributor

    Failed in: runtime-coreclr jitstress 20260920.1

    Failed tests:

    coreclr windows arm64 Checked tailcallstress @ Windows.11.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    
    

    Error message:

    Assert.Equal() Failure: Values differ
    Expected: 100
    Actual:   1
    

    Stack trace:

       at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 102
       at Program.<<Main>$>g__TestExecutor23|0_24(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
    
  8. VincentBu commented on Sep 29, 2026

    @VincentBu
    Contributor

    Failed in: runtime-coreclr pgo 20260928.1

    Failed tests:

    coreclr linux arm64 Checked defaultpgo @ AzureLinux.3.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    
    

    Error message:

    Assert.Equal() Failure: Values differ
    Expected: 100
    Actual:   1
    

    Stack trace:

       at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 102
       at Program.<<Main>$>g__TestExecutor23|0_24(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
    
  9. VincentBu commented on Oct 8, 2026

    @VincentBu
    Contributor

    Failed in: runtime-coreclr r2r-extra 20261003.1

    Failed tests:

    R2R-CG2 windows arm64 Checked jitstressregs2 @ Windows.11.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    R2R-CG2 windows arm64 Checked jitstressregs4 @ Windows.11.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    R2R-CG2 windows arm64 Checked jitstressregs0x80 @ Windows.11.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    R2R-CG2 windows x86 Checked jitminopts @ Windows.10.Amd64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    
    

    Error message:

    Assert.Equal() Failure: Values differ
    Expected: 100
    Actual:   1
    

    Stack trace:

    at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 102
       at Program.<<Main>$>g__TestExecutor23|0_24(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
    
  10. VincentBu commented on Oct 12, 2026

    @VincentBu
    Contributor

    Failed in: runtime-coreclr jitstressregs 20261010.1

    Failed tests:

    coreclr windows arm64 Checked jitstressregs1 @ Windows.11.Arm64.Open
    - GC/API/GC/GetGeneration/GetGeneration.dll
    
    

    Error message:

    Assert.Equal() Failure: Values differ
    Expected: 100
    Actual:   1
    

    Stack trace:

       at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 102
       at Program.<<Main>$>g__TestExecutor23|0_24(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
    
  11. pcshrosbree commented on Oct 12, 2026

    @pcshrosbree
    Contributor

    Another hit, this time on a plain leg: PR #135520, build 1632403, coreclr linux x64 Checked @ AzureLinux.3.Amd64.Open (console log). The log shows no JIT-stress, GC-stress, RunCrossGen2 or interpreter settings; the normal stress script sets only the crash-dump variables. The PR's product change is confined to interpreter execution, which is not enabled in the logged configuration.

    Running test: GC/API/GC/GetGeneration/GetGeneration.dll
    ObjectTest Passed!
    0 0
    arrayTest Failed!
    failTest Passed!
    
    Test for GetGeneration() FAILED!
    Xunit.Sdk.EqualException: Assert.Equal() Failure: Values differ
    Expected: 100
    Actual:   1
    

    Build Analysis lists this failure as unmatched. This issue currently has neither the Known Build Error label nor a JSON block in its description. Could you add the label, and this block to the description?

    {
      "ErrorMessage": "Test for GetGeneration() FAILED!",
      "ErrorPattern": "",
      "BuildRetry": false,
      "ExcludeConsoleLog": false
    }

    It is a single string because the Expected: 100 / Actual: 1 pair is the merged runner's generic exit-code assertion. Test for GetGeneration() FAILED! is printed by this test and identifies its failure.

    On the cause, this fits your comment above, @janvorli. #126108 removed this test's process isolation, and #132076 restored it for Collect, Collect0 and Collect1 but not for GetGeneration. So the test still runs inside the merged GC runner, after the GCHandle tests and GetAllocatedBytesForCurrentThread.

    On a local linux-x64 Checked build, I ran the full merged GC runner 200 times with the same corerun arguments and test order as the CI work item, on a runtime without #135520's change. GetGeneration failed once (0 0, ObjectTest Failed!). It did not fail in 200 runs with the change, but that rate is too low to compare the two builds.

    Separately, I wrote a small probe that runs the arrayTest check with 200 pinned 1000-byte arrays allocated before the tested array. It failed the check in about 48% to 90% of iterations, over three runs of 1000 iterations on each build, and each run's first recorded failure was 0 0. The unpinned variant and the pins-after-the-array variant had no failures. This shows one way to produce the failure; it does not establish whether pinned objects caused the CI failure or where they came from.

    I can follow up with a PR adding <RequiresProcessIsolation>true</RequiresProcessIsolation> to GetGeneration.csproj, following #132076.

    Note

    This comment was prepared with AI assistance (Anthropic Claude, checked by OpenAI Codex) at my request. I reviewed it and the measurements before posting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

  • Status
    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions