dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.16k stars 4.71k forks source link

CollectionsMarshal.AsSpan assertion failure in System.Text.Json tests #96876

Closed jkotas closed 9 months ago

jkotas commented 9 months ago

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=524311 Build error leg or test failing: System.Text.Json.Tests.WorkItemExecution Pull request: https://github.com/dotnet/runtime/pull/96870

Error Message

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

{
  "ErrorMessage": "Implementation depends on List<T> always using a T[] and not U[] where U : T.",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: :mag_right: https://dev.azure.com/dnceng-public/public/_build/results?buildId=524311 Error message validated: Implementation depends on List<T> always using a T[] and not U[] where U : T. Result validation: :white_check_mark: Known issue matched with the provided build. Validation performed at: 1/12/2024 1:31:48 AM UTC

Report

Build Definition Test Pull Request
524882 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#95583
525560 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96609
526100 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96880
525785 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96913
525988 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96928
525991 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#89472
525957 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96927
525923 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96926
525892 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96201
525842 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96924
525765 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96921
525686 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96916
525621 dotnet/runtime System.Text.Json.Tests.WorkItemExecution
525570 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96880
525477 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96805
525444 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96867
525362 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96880
525344 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96741
525094 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96894
525249 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96896
525236 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96445
525231 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96890
525196 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96214
525140 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96676
525086 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96893
525001 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96741
524968 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96892
524959 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96558
524862 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96889
524798 dotnet/runtime System.Text.Json.Tests.WorkItemExecution
524790 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#95583
524621 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96860
524464 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96805
524458 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96867
524255 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96829
524448 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96858
524210 dotnet/runtime System.Text.Json.Tests.WorkItemExecution
524311 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96870
524291 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96867
524193 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96858
524168 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96805
524110 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96795
524101 dotnet/runtime System.Text.Json.Tests.WorkItemExecution dotnet/runtime#96699

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 43 43
ghost commented 9 months ago

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries See info in area-owners.md if you want to be subscribed.

Issue Details
## Build Information Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=524311 Build error leg or test failing: System.Text.Json.Tests.WorkItemExecution Pull request: https://github.com/dotnet/runtime/pull/96870 ## Error Message Fill the error message using [step by step known issues guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Projects/Build%20Analysis/KnownIssues.md#how-to-fill-out-a-known-issue-error-section). ```json { "ErrorMessage": "Implementation depends on List always using a T[] and not U[] where U : T.", "ErrorPattern": "", "BuildRetry": false, "ExcludeConsoleLog": false } ```
Author: jkotas
Assignees: -
Labels: `area-Infrastructure-libraries`, `blocking-clean-ci`, `Known Build Error`
Milestone: -
jkotas commented 9 months ago

cc @stephentoub

stephentoub commented 9 months ago

bleh, the change is flawed. will revert and rethink.

jkotas commented 9 months ago

bleh, the change is flawed. will revert and rethink.

Where is the flaw?

stephentoub commented 9 months ago

Hmm, I was thinking for a moment it would still need to check and actually throw, but with lists being invariant, it shouldn't be possible to specify a T and pass in a List of a derived type. So now I don't know what's going on and will need to look at what the failing test is doing, but I'm away from my computer through the weekend.

ghost commented 9 months ago

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis See info in area-owners.md if you want to be subscribed.

Issue Details
## Build Information Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=524311 Build error leg or test failing: System.Text.Json.Tests.WorkItemExecution Pull request: https://github.com/dotnet/runtime/pull/96870 ## Error Message Fill the error message using [step by step known issues guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Projects/Build%20Analysis/KnownIssues.md#how-to-fill-out-a-known-issue-error-section). ```json { "ErrorMessage": "Implementation depends on List always using a T[] and not U[] where U : T.", "ErrorPattern": "", "BuildRetry": false, "ExcludeConsoleLog": false } ``` ### Known issue validation **Build: :mag_right:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=524311 **Error message validated:** `Implementation depends on List always using a T[] and not U[] where U : T.` **Result validation:** :white_check_mark: Known issue matched with the provided build. **Validation performed at:** 1/12/2024 1:31:48 AM UTC ### Report |Build|Definition|Test|Pull Request| |---|---|---|---| |[524464](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524464)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524464&view=ms.vss-test-web.build-test-results-tab&runId=12338542&resultId=200266)|dotnet/runtime#96805| |[524458](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524458)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524458&view=ms.vss-test-web.build-test-results-tab&runId=12338530&resultId=200255)|dotnet/runtime#96867| |[524255](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524255)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524255&view=ms.vss-test-web.build-test-results-tab&runId=12337682&resultId=200247)|dotnet/runtime#96829| |[524448](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524448)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524448&view=ms.vss-test-web.build-test-results-tab&runId=12337672&resultId=200255)|dotnet/runtime#96858| |[524210](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524210)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524210&view=ms.vss-test-web.build-test-results-tab&runId=12333996&resultId=200247)|| |[524311](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524311)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524311&view=ms.vss-test-web.build-test-results-tab&runId=12332614&resultId=200247)|dotnet/runtime#96870| |[524291](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524291)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524291&view=ms.vss-test-web.build-test-results-tab&runId=12332148&resultId=200247)|dotnet/runtime#96867| |[524193](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524193)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524193&view=ms.vss-test-web.build-test-results-tab&runId=12328450&resultId=200247)|dotnet/runtime#96858| |[524168](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524168)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524168&view=ms.vss-test-web.build-test-results-tab&runId=12328000&resultId=200258)|dotnet/runtime#96805| |[524110](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524110)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524110&view=ms.vss-test-web.build-test-results-tab&runId=12325752&resultId=200234)|dotnet/runtime#96795| |[524101](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524101)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524101&view=ms.vss-test-web.build-test-results-tab&runId=12325584&resultId=200247)|dotnet/runtime#96699| #### Summary |24-Hour Hit Count|7-Day Hit Count|1-Month Count| |---|---|---| |11|11|11|
Author: jkotas
Assignees: -
Labels: `area-System.Text.Json`, `blocking-clean-ci`, `untriaged`, `in-pr`, `Known Build Error`
Milestone: -
jkotas commented 9 months ago

I am not able to reproduce the failure. It seems to be Linux Alpine Arm64 specific.

Raphtaliyah commented 9 months ago

I've tried a few things to reproduce it with no success. However, it reproduces on checked builds on x64 Linux (ubuntu!) (here's one for example). I've just noticed that it only happens on checked runtimes so I'm currently building one to verify it. I do have a guess as to what could be the issue: in the span ctor there is a type check however it gets skipped if the type is a value type, the failing code does the check for value types as well. As the stack traces make no sense I'm not sure if it's in any way realistic that T is ever a value type where it doesn't match the actual array type but that's the only (obvious) difference. I'm currently trying to verify it.

jkotas commented 9 months ago

This is codegen bug in PGO optimized code. The repro is not deterministic since it is triggered by a particular profile.

I have looked at the dump from runfo get-helix-payload -j ec78045b-ffd3-4800-9c13-a3f3db5a5b72 -w System.Text.Json.Tests -o $HOME/helix_payload/System.Text.Json.Tests.

The codegen bug is in the PGO optimized VerifyWeatherForecastWithPOCOs method. The JIT inlines the OrderBy Linq call graph into the method, including the CollectionsMarshal.AsSpan method called by the Linq.

Here is the disassembly of the inlined CollectionsMarshal.AsSpan with the codegen bug:

...
    // Debug.Assert(items is not null, "Implementation depends on List<T> always having an array.");
    0x7fa2699feef8: testq  %r8, %r8
    0x7fa2699feefb: jne    0x7fa2699fef17
    0x7fa2699feefd: movabsq $0x7fa254205690, %rdi     ; string "Implementation depends on List<T> always having an array."
    0x7fa2699fef07: movabsq $0x7fa254200008, %rsi     ; string ""
    0x7fa2699fef11: callq  *-0x10151d47(%rip)

    // if ((uint)size > (uint)items.Length)
    0x7fa2699fef17: movq   -0x418(%rbp), %r8 items
    0x7fa2699fef1e: movl   -0x1c0(%rbp), %ecx length
    0x7fa2699fef24: cmpl   %ecx, 0x8(%r8) items.Length
    0x7fa2699fef28: jb     0x7fa2699ffe5c

    // Debug.Assert(typeof(T[]) == list._items.GetType(), "Implementation depends on List<T> always using a T[] and not U[] where U : T.");
    // BUG: The JIT incorrectly evaluated typeof(T[]) == list._items.GetType() as constant false and just left the null check
    0x7fa2699fef2e: movq   -0x400(%rbp), %rax
    0x7fa2699fef35: movq   0x8(%rax), %rdi
    0x7fa2699fef39: cmpb   %dil, (%rdi) // null check
    0x7fa2699fef3c: movabsq $0x7fa254228198, %rdi     ; string "Implementation depends on List<T> always using a T[] and not U[] where U : T."
    0x7fa2699fef46: movabsq $0x7fa254200008, %rsi     ; string ""
    0x7fa2699fef50: callq  *-0x10151d86(%rip) System.Diagnostics.Debug.Fail
...
ghost commented 9 months ago

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.

Issue Details
## Build Information Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=524311 Build error leg or test failing: System.Text.Json.Tests.WorkItemExecution Pull request: https://github.com/dotnet/runtime/pull/96870 ## Error Message Fill the error message using [step by step known issues guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Projects/Build%20Analysis/KnownIssues.md#how-to-fill-out-a-known-issue-error-section). ```json { "ErrorMessage": "Implementation depends on List always using a T[] and not U[] where U : T.", "ErrorPattern": "", "BuildRetry": false, "ExcludeConsoleLog": false } ``` ### Known issue validation **Build: :mag_right:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=524311 **Error message validated:** `Implementation depends on List always using a T[] and not U[] where U : T.` **Result validation:** :white_check_mark: Known issue matched with the provided build. **Validation performed at:** 1/12/2024 1:31:48 AM UTC ### Report |Build|Definition|Test|Pull Request| |---|---|---|---| |[525560](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525560)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525560&view=ms.vss-test-web.build-test-results-tab&runId=12365704&resultId=200263)|dotnet/runtime#96609| |[525570](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525570)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525570&view=ms.vss-test-web.build-test-results-tab&runId=12365784&resultId=200263)|dotnet/runtime#96880| |[525477](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525477)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525477&view=ms.vss-test-web.build-test-results-tab&runId=12362376&resultId=200363)|dotnet/runtime#96805| |[525444](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525444)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525444&view=ms.vss-test-web.build-test-results-tab&runId=12362094&resultId=200258)|dotnet/runtime#96867| |[525362](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525362)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525362&view=ms.vss-test-web.build-test-results-tab&runId=12359526&resultId=200352)|dotnet/runtime#96880| |[525344](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525344)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525344&view=ms.vss-test-web.build-test-results-tab&runId=12358858&resultId=200258)|dotnet/runtime#96741| |[525094](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525094)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525094&view=ms.vss-test-web.build-test-results-tab&runId=12357934&resultId=200255)|dotnet/runtime#96894| |[525249](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525249)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525249&view=ms.vss-test-web.build-test-results-tab&runId=12357564&resultId=200255)|dotnet/runtime#96896| |[525236](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525236)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525236&view=ms.vss-test-web.build-test-results-tab&runId=12357546&resultId=200349)|dotnet/runtime#96445| |[525231](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525231)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525231&view=ms.vss-test-web.build-test-results-tab&runId=12357280&resultId=200255)|dotnet/runtime#96890| |[525196](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525196)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525196&view=ms.vss-test-web.build-test-results-tab&runId=12356392&resultId=200349)|dotnet/runtime#96214| |[525140](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525140)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525140&view=ms.vss-test-web.build-test-results-tab&runId=12354936&resultId=200349)|dotnet/runtime#96676| |[525086](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525086)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525086&view=ms.vss-test-web.build-test-results-tab&runId=12353926&resultId=200255)|dotnet/runtime#96893| |[525001](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525001)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=525001&view=ms.vss-test-web.build-test-results-tab&runId=12352202&resultId=200255)|dotnet/runtime#96741| |[524882](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524882)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524882&view=ms.vss-test-web.build-test-results-tab&runId=12352178&resultId=200255)|dotnet/runtime#95583| |[524968](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524968)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524968&view=ms.vss-test-web.build-test-results-tab&runId=12351974&resultId=200349)|dotnet/runtime#96892| |[524959](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524959)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524959&view=ms.vss-test-web.build-test-results-tab&runId=12351836&resultId=200255)|dotnet/runtime#96558| |[524862](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524862)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524862&view=ms.vss-test-web.build-test-results-tab&runId=12349536&resultId=200255)|dotnet/runtime#96889| |[524798](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524798)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524798&view=ms.vss-test-web.build-test-results-tab&runId=12347658&resultId=200349)|| |[524790](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524790)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524790&view=ms.vss-test-web.build-test-results-tab&runId=12347384&resultId=200349)|dotnet/runtime#95583| |[524621](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524621)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524621&view=ms.vss-test-web.build-test-results-tab&runId=12342992&resultId=200255)|dotnet/runtime#96860| |[524464](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524464)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524464&view=ms.vss-test-web.build-test-results-tab&runId=12338542&resultId=200266)|dotnet/runtime#96805| |[524458](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524458)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524458&view=ms.vss-test-web.build-test-results-tab&runId=12338530&resultId=200255)|dotnet/runtime#96867| |[524255](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524255)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524255&view=ms.vss-test-web.build-test-results-tab&runId=12337682&resultId=200247)|dotnet/runtime#96829| |[524448](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524448)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524448&view=ms.vss-test-web.build-test-results-tab&runId=12337672&resultId=200255)|dotnet/runtime#96858| |[524210](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524210)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524210&view=ms.vss-test-web.build-test-results-tab&runId=12333996&resultId=200247)|| |[524311](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524311)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524311&view=ms.vss-test-web.build-test-results-tab&runId=12332614&resultId=200247)|dotnet/runtime#96870| |[524291](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524291)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524291&view=ms.vss-test-web.build-test-results-tab&runId=12332148&resultId=200247)|dotnet/runtime#96867| |[524193](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524193)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524193&view=ms.vss-test-web.build-test-results-tab&runId=12328450&resultId=200247)|dotnet/runtime#96858| |[524168](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524168)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524168&view=ms.vss-test-web.build-test-results-tab&runId=12328000&resultId=200258)|dotnet/runtime#96805| |[524110](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524110)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524110&view=ms.vss-test-web.build-test-results-tab&runId=12325752&resultId=200234)|dotnet/runtime#96795| |[524101](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524101)|dotnet/runtime|[System.Text.Json.Tests.WorkItemExecution](https://dev.azure.com/dnceng-public/public/_build/results?buildId=524101&view=ms.vss-test-web.build-test-results-tab&runId=12325584&resultId=200247)|dotnet/runtime#96699| #### Summary |24-Hour Hit Count|7-Day Hit Count|1-Month Count| |---|---|---| |26|32|32|
Author: jkotas
Assignees: -
Labels: `area-System.Text.Json`, `area-CodeGen-coreclr`, `blocking-clean-ci`, `in-pr`, `Known Build Error`
Milestone: 9.0.0
jkotas commented 9 months ago

I am commenting out the assert in #96877 to workaround the bug. Please add the assert back once the issue is fixed.

EgorBo commented 9 months ago

Managed to repro locally on Main, investigating...

EgorBo commented 9 months ago

Minimal repro:

class Program
{
    static void Main()
    {
        Console.WriteLine(foo<string>(new string[1]));
        Console.ReadKey();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static bool foo<T>(string[] list) => typeof(T[]) == list.GetType();
}

Reproduces without PGO, seems like the bug is in gtFoldTypeCompare

EgorBo commented 9 months ago

This is the current culprit:

image

same VM call in .NET 8.0 (where bug is not manifested) returns May

jakobbotsch commented 9 months ago

From a bisection, the regression seems to have been introduced in range https://github.com/dotnet/runtime/compare/82ac648e132b422354643a90032cc67439c6921c...23a93aa2305d580b6e77f7254624d0b1787b3008.

EgorBo commented 9 months ago

From a bisection, the regression seems to have been introduced in range 82ac648...23a93aa.

cc @davidwrighton @jkotas Could it be https://github.com/dotnet/runtime/pull/96466 ?

TLDR: it seems that JIT-EE compareTypesForEquality(string[], _Canon[]) returns MustNot now.

jkotas commented 9 months ago

Could it be https://github.com/dotnet/runtime/pull/96466 ?

Yes, that change included a fix in HasSameTypeDefAs that broke implementation of compareTypesForEquality. Thank you for tracking it down!