Skip to content
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

Test failure Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd #84007

Closed
v-wenyuxu opened this issue Mar 28, 2023 · 8 comments · Fixed by #84275
Assignees
Labels
arch-arm64 arch-x64 arch-x86 area-crossgen2-coreclr blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs os-linux Linux OS (any supported distro) os-mac-os-x macOS aka OSX os-windows
Milestone

Comments

@v-wenyuxu
Copy link

Run: runtime-coreclr outerloop 20230327.2

Failed test:


R2R-CG2 windows arm64 Checked no_tiered_compilation @ Windows.11.Arm64.Open

- Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd

R2R-CG2 linux x64 Checked no_tiered_compilation @ (Alpine.315.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.15-helix-amd64

- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 windows x86 Checked no_tiered_compilation @ Windows.10.Amd64.Open

- Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd

R2R-CG2 windows x64 Checked @ Windows.10.Amd64.Open

- Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd

R2R-CG2 windows x64 Checked @ Windows.10.Amd64.Open

- Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd
... ...

Error message:

Return code:      1
Raw output file:      C:\h\w\AA970943\w\AFD009BD\uploads\Reports\Loader.classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\CctorForWrite.output.txt
Raw output:
BEGIN EXECUTION
CctorForWrite.dll
1 file(s) copied.
20:30:54.97
Response file: C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\CctorForWrite.dll.rsp
C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\IL-CG2\CctorForWrite.dll
-o:C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\CctorForWrite.dll
--targetarch:arm64
--targetos:windows
--verify-type-and-field-layout
--method-layout:random
-r:C:\h\w\AA970943\p\System..dll
-r:C:\h\w\AA970943\p\Microsoft..dll
-r:C:\h\w\AA970943\p\xunit.*.dll
-r:C:\h\w\AA970943\p\mscorlib.dll
-r:C:\h\w\AA970943\p\netstandard.dll
-O
" "dotnet" "C:\h\w\AA970943\p\crossgen2\crossgen2.dll" @"C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\CctorForWrite.dll.rsp"   -r:C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\IL-CG2*.dll"
Emitting R2R PE file: C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\CctorForWrite.dll
" "dotnet" "C:\h\w\AA970943\p\r2rdump\r2rdump.dll" --header --sc --in C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\CctorForWrite.dll --out C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\CctorForWrite.dll.r2rdump --val"
20:30:57.25
"C:\h\w\AA970943\p\corerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false"  CctorForWrite.dll
Expected: 100
Actual: 1
END EXECUTION - FAILED
FAILED
Test failed. Trying to see if dump file was created in C:\cores since 3/27/2023 8:30:54 PM
Test Harness Exitcode is : 1
To run the test:

set CORE_ROOT=C:\h\w\AA970943\p
C:\h\w\AA970943\w\AFD009BD\e\Loader\classloader\TypeInitialization\CctorsWithSideEffects\CctorForWrite\CctorForWrite.cmd
Expected: True
Actual:   False


Stack trace
   at Loader_classloader._TypeInitialization_CctorsWithSideEffects_CctorForWrite_CctorForWrite_._TypeInitialization_CctorsWithSideEffects_CctorForWrite_CctorForWrite_cmd()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
@v-wenyuxu v-wenyuxu added arch-arm64 arch-x86 os-linux Linux OS (any supported distro) os-mac-os-x macOS aka OSX os-windows arch-x64 blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs labels Mar 28, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Mar 28, 2023
@markples markples self-assigned this Mar 29, 2023
@markples markples added this to the 8.0.0 milestone Mar 29, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Mar 29, 2023
@BruceForstall
Copy link
Member

@markples Any update on this?

trylek added a commit to trylek/runtime that referenced this issue Apr 3, 2023
@markples
Copy link
Member

markples commented Apr 3, 2023

I have seen that the IR coming out of the importer is incorrect but haven't debugged the importer itself to see how the code path is different for R2R to cause that.

@markples
Copy link
Member

markples commented Apr 3, 2023

For reference, this test was created to show a fixed JIT bug for the code

            ClassWithCctor.StaticField = Call();

where the type initializer for ClassWithCctor was being run before Call was called.

In the R2R case, the stsfld code in the JIT checks the static field and does not find CORINFO_FLG_FIELD_INITCLASS set.

(Aside: This made me think maybe it was run at startup/early, but I have a callstack with the static field helper call on the stack and the type initialization exception being thrown.)

@markples
Copy link
Member

markples commented Apr 3, 2023

image

@trylek
Copy link
Member

trylek commented Apr 3, 2023

If I'm right to interpret the name of the test so that it refers to the static constructor (.cctor), the last time I looked Crossgen2 didn't precompile any of these, I actually pointed that out several times in the past that we should as these are often involved in startup performance.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Apr 4, 2023
@markples
Copy link
Member

markples commented Apr 4, 2023

Thanks. I was specifically looking for not just precompiling but also executing (whether compiled or interpreted) since that would impact ordering. (and to be clear, that also doesn't seem to be the case, as it shouldn't since this one has side effects)

The problem seems to be the JIT importer using CORINFO_FLG_FIELD_INITCLASS to mean "has a static constructor / type initializer" rather than "requires a separate call to initialize the type". The draft PR attached above addresses this but may not be the right overall fix.

@AndyAyersMS
Copy link
Member

Original fix was in #80485

trylek added a commit that referenced this issue Apr 4, 2023
* Add issues.targets entry for known issue #84007

* Add handling for NEW_MDARR_RARE

---------

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
@v-wenyuxu
Copy link
Author

Failed again in: runtime-coreclr crossgen2 20230403.1

Failed test:

R2R-CG2 linux arm64 Checked no_tiered_compilation @ (Ubuntu.1804.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8
- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 linux arm64 Checked @ (Ubuntu.1804.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8
- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 linux x64 Checked no_tiered_compilation @ Ubuntu.1804.Amd64.Open
- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 linux x64 Checked @ Ubuntu.1804.Amd64.Open
- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 windows arm64 Checked no_tiered_compilation @ Windows.11.Arm64.Open
- Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd

R2R-CG2 windows arm64 Checked no_tiered_compilation @ Windows.11.Arm64.Open
- Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd

R2R-CG2 osx arm64 Checked @ OSX.1200.ARM64.Open
- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 osx arm64 Checked no_tiered_compilation @ OSX.1200.ARM64.Open
- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 osx x64 Checked no_tiered_compilation @ OSX.1200.Amd64.Open
- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 osx x64 Checked @ OSX.1200.Amd64.Open
- Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh

R2R-CG2 windows x64 Checked no_tiered_compilation @ Windows.10.Amd64.Open
- Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd

R2R-CG2 windows x64 Checked @ Windows.10.Amd64.Open
- Loader\\classloader\\TypeInitialization\\CctorsWithSideEffects\\CctorForWrite\\CctorForWrite.cmd

Error message:

/root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh: line 305: -r:/root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/IL-CG2/*.dll: No such file or directory

Return code:      1
Raw output file:      /root/helix/work/workitem/uploads/Reports/Loader.classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.output.txt
Raw output:
BEGIN EXECUTION
in takeLock
/root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/IL-CG2/CctorForWrite.dll
07:49:20
Response file: /root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.dll.rsp
/root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/IL-CG2/CctorForWrite.dll
-o:/root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.dll
-r:/root/helix/work/correlation/System..dll
-r:/root/helix/work/correlation/Microsoft..dll
-r:/root/helix/work/correlation/xunit.*.dll
-r:/root/helix/work/correlation/mscorlib.dll
--verify-type-and-field-layout
--method-layout:random
--targetarch:arm64
--targetos:linux
-O
Running CrossGen2:  dotnet /root/helix/work/correlation/crossgen2/crossgen2.dll @/root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.dll.rsp

Emitting R2R PE file: /root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.dll
Running R2RDump:  dotnet /root/helix/work/correlation/R2RDump/R2RDump.dll --header --sc --in /root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.dll --out /root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.dll.r2rdump --val
07:49:21
in ReleaseLock
in takeLock
/root/helix/work/correlation/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false CctorForWrite.dll ''
in ReleaseLock
Expected: 100
Actual: 1
END EXECUTION - FAILED
Test failed. Trying to see if dump file was created in /home/helixbot/dotnetbuild/dumps since 4/4/2023 7:49:20 AM
Test Harness Exitcode is : 1
To run the test:
> set CORE_ROOT=/root/helix/work/correlation
> /root/helix/work/workitem/e/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh
Expected: True
Actual:   False


Stack trace
   at Loader_classloader._TypeInitialization_CctorsWithSideEffects_CctorForWrite_CctorForWrite_._TypeInitialization_CctorsWithSideEffects_CctorForWrite_CctorForWrite_sh()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Queued Pipeline Pipeline_Configuration OS Arch Test Outcome Properties BuildReason
2023-04-03T12:49:22.562Z runtime-extra-platforms Release ubuntu.1804.amd64.android.29.open.rt x64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"System.StageAttempt":"2","operatingSystem":"Ubuntu.1804.Amd64.Android.29.Open","BuildId":"225915","DefinitionId":"154","System.PhaseAttempt":"2","Reason":"Schedule","architecture":"x64","configuration":"Release","System.JobName":"__default","System.JobAttempt":"2","Project":"public","BuildNumber":"20230403.1","DefinitionName":"runtime-extra-platforms","System.JobId":"2710b830-bfa8-5592-b8bc-89224650110b","System.PhaseName":"build_android_x64_Release_AllSubsets_Mono_RuntimeTests","CollectionUri":"https://dev.azure.com/dnceng-public/","System.StageName":"Build","AzurePipelinesTestRunId":"4250780"} Schedule
2023-04-03T11:13:11.167Z runtime-coreclr outerloop Checked osx.1200.amd64.open x64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"operatingSystem":"OSX.1200.Amd64.Open","Project":"public","System.StageAttempt":"1","DefinitionName":"runtime-coreclr outerloop","BuildNumber":"20230403.1","System.PhaseName":"run_test_p1_R2R_CG2_osx_x64_checked","System.PhaseAttempt":"1","BuildId":"225919","System.JobAttempt":"1","System.StageName":"Build","architecture":"x64","System.JobId":"2bb87d59-31ba-55f9-0713-03158c3fd52f","DefinitionId":"108","System.JobName":"__default","Reason":"Schedule","AzurePipelinesTestRunId":"4248992","configuration":"Checked","CollectionUri":"https://dev.azure.com/dnceng-public/"} Schedule
2023-04-03T11:13:09.836Z runtime-coreclr outerloop Checked-no_tiered_compilation osx.1200.amd64.open x64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"System.JobAttempt":"1","System.PhaseAttempt":"1","System.StageName":"Build","System.JobName":"__default","System.PhaseName":"run_test_p1_R2R_CG2_osx_x64_checked","System.StageAttempt":"1","operatingSystem":"OSX.1200.Amd64.Open","Project":"public","configuration":"Checked-no_tiered_compilation","System.JobId":"2bb87d59-31ba-55f9-0713-03158c3fd52f","AzurePipelinesTestRunId":"4248996","DefinitionId":"108","BuildNumber":"20230403.1","Reason":"Schedule","architecture":"x64","CollectionUri":"https://dev.azure.com/dnceng-public/","BuildId":"225919","DefinitionName":"runtime-coreclr outerloop"} Schedule
2023-04-03T10:22:34.151Z runtime-coreclr outerloop Checked ubuntu.1804.amd64.open.rt x64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"architecture":"x64","System.JobName":"__default","System.JobId":"92e17f34-a5d5-5d2c-e1e5-826eb9786835","System.StageName":"Build","Reason":"Schedule","AzurePipelinesTestRunId":"4248528","operatingSystem":"(Alpine.315.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.15-helix-amd64","System.PhaseName":"run_test_p1_R2R_CG2_linux_musl_x64_checked","BuildId":"225919","configuration":"Checked","Project":"public","System.JobAttempt":"1","BuildNumber":"20230403.1","DefinitionId":"108","System.StageAttempt":"1","System.PhaseAttempt":"1","DefinitionName":"runtime-coreclr outerloop","CollectionUri":"https://dev.azure.com/dnceng-public/"} Schedule
2023-04-03T10:22:32.979Z runtime-coreclr outerloop Checked-no_tiered_compilation ubuntu.1804.amd64.open.rt x64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"System.JobId":"92e17f34-a5d5-5d2c-e1e5-826eb9786835","DefinitionName":"runtime-coreclr outerloop","BuildId":"225919","architecture":"x64","operatingSystem":"(Alpine.315.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.15-helix-amd64","DefinitionId":"108","System.JobName":"__default","System.JobAttempt":"1","AzurePipelinesTestRunId":"4248530","System.PhaseName":"run_test_p1_R2R_CG2_linux_musl_x64_checked","System.StageAttempt":"1","CollectionUri":"https://dev.azure.com/dnceng-public/","Reason":"Schedule","BuildNumber":"20230403.1","configuration":"Checked-no_tiered_compilation","System.StageName":"Build","System.PhaseAttempt":"1","Project":"public"} Schedule
2023-04-03T10:22:18.334Z runtime-coreclr outerloop Checked-no_tiered_compilation ubuntu.1804.armarch.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"DefinitionId":"108","Reason":"Schedule","CollectionUri":"https://dev.azure.com/dnceng-public/","AzurePipelinesTestRunId":"4248492","System.StageAttempt":"1","System.JobAttempt":"1","System.StageName":"Build","architecture":"arm64","operatingSystem":"(Ubuntu.1804.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8","System.PhaseName":"run_test_p1_R2R_CG2_linux_arm64_checked","Project":"public","BuildId":"225919","DefinitionName":"runtime-coreclr outerloop","configuration":"Checked-no_tiered_compilation","System.JobId":"2e21645a-5873-5561-8d4d-44187d33621f","System.JobName":"__default","System.PhaseAttempt":"1","BuildNumber":"20230403.1"} Schedule
2023-04-03T10:22:17.338Z runtime-coreclr outerloop Checked ubuntu.1804.armarch.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"DefinitionName":"runtime-coreclr outerloop","DefinitionId":"108","System.PhaseName":"run_test_p1_R2R_CG2_linux_arm64_checked","System.JobName":"__default","System.JobAttempt":"1","System.JobId":"2e21645a-5873-5561-8d4d-44187d33621f","CollectionUri":"https://dev.azure.com/dnceng-public/","System.StageAttempt":"1","configuration":"Checked","Reason":"Schedule","operatingSystem":"(Ubuntu.1804.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8","BuildId":"225919","AzurePipelinesTestRunId":"4248490","System.PhaseAttempt":"1","Project":"public","BuildNumber":"20230403.1","System.StageName":"Build","architecture":"arm64"} Schedule
2023-04-03T10:21:27.363Z runtime-coreclr outerloop Checked-no_tiered_compilation ubuntu.1804.amd64.open.rt x64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"operatingSystem":"Ubuntu.1804.Amd64.Open","System.PhaseAttempt":"1","configuration":"Checked-no_tiered_compilation","System.PhaseName":"run_test_p1_R2R_CG2_linux_x64_checked","System.JobAttempt":"1","DefinitionId":"108","DefinitionName":"runtime-coreclr outerloop","System.StageAttempt":"1","AzurePipelinesTestRunId":"4248482","System.JobName":"__default","Reason":"Schedule","Project":"public","BuildNumber":"20230403.1","BuildId":"225919","architecture":"x64","CollectionUri":"https://dev.azure.com/dnceng-public/","System.StageName":"Build","System.JobId":"fa2c7683-52dc-5163-1de4-3cf5b1b4c990"} Schedule
2023-04-03T10:21:26.202Z runtime-coreclr outerloop Checked ubuntu.1804.amd64.open.rt x64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"BuildId":"225919","Project":"public","System.PhaseName":"run_test_p1_R2R_CG2_linux_x64_checked","System.StageName":"Build","System.PhaseAttempt":"1","configuration":"Checked","DefinitionId":"108","BuildNumber":"20230403.1","System.StageAttempt":"1","Reason":"Schedule","DefinitionName":"runtime-coreclr outerloop","System.JobName":"__default","architecture":"x64","AzurePipelinesTestRunId":"4248480","operatingSystem":"Ubuntu.1804.Amd64.Open","System.JobAttempt":"1","System.JobId":"fa2c7683-52dc-5163-1de4-3cf5b1b4c990","CollectionUri":"https://dev.azure.com/dnceng-public/"} Schedule
More failures
Queued Pipeline Pipeline_Configuration OS Arch Test Outcome Properties BuildReason
2023-04-03T10:21:25.081Z runtime-coreclr outerloop Checked-no_tiered_compilation ubuntu.1804.armarch.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"DefinitionName":"runtime-coreclr outerloop","System.StageName":"Build","Reason":"Schedule","System.JobAttempt":"1","System.PhaseAttempt":"1","operatingSystem":"(Alpine.315.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.15-helix-arm64v8","System.PhaseName":"run_test_p1_R2R_CG2_linux_musl_arm64_checked","Project":"public","System.StageAttempt":"1","configuration":"Checked-no_tiered_compilation","DefinitionId":"108","CollectionUri":"https://dev.azure.com/dnceng-public/","AzurePipelinesTestRunId":"4248486","System.JobName":"__default","BuildNumber":"20230403.1","architecture":"arm64","BuildId":"225919","System.JobId":"8e219403-74a1-530a-f547-c14188aff86d"} Schedule
2023-04-03T10:21:23.925Z runtime-coreclr outerloop Checked ubuntu.1804.armarch.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"operatingSystem":"(Alpine.315.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.15-helix-arm64v8","DefinitionId":"108","Reason":"Schedule","Project":"public","architecture":"arm64","BuildId":"225919","configuration":"Checked","System.StageName":"Build","System.JobAttempt":"1","System.PhaseName":"run_test_p1_R2R_CG2_linux_musl_arm64_checked","CollectionUri":"https://dev.azure.com/dnceng-public/","DefinitionName":"runtime-coreclr outerloop","BuildNumber":"20230403.1","System.JobId":"8e219403-74a1-530a-f547-c14188aff86d","System.PhaseAttempt":"1","System.JobName":"__default","AzurePipelinesTestRunId":"4248484","System.StageAttempt":"1"} Schedule
2023-04-03T08:02:24.917Z runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitminopts_heapverify1 osx.1200.arm64.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"Project":"public","BuildId":"225827","DefinitionId":"141","System.StageName":"Build","operatingSystem":"OSX.1200.ARM64.Open","configuration":"Checked-gcstress0xc_jitminopts_heapverify1","System.JobName":"__default","System.PhaseAttempt":"1","System.StageAttempt":"1","System.JobId":"4b5575ba-4f05-5198-bc88-a075c735caa5","BuildNumber":"20230402.1","CollectionUri":"https://dev.azure.com/dnceng-public/","System.PhaseName":"run_test_p1_Composite_osx_arm64_checked","DefinitionName":"runtime-coreclr crossgen2-composite gcstress","architecture":"arm64","System.JobAttempt":"1","AzurePipelinesTestRunId":"4245858","Reason":"Schedule"} Schedule
2023-04-03T08:02:24.917Z runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitminopts_heapverify1 osx.1200.arm64.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"Project":"public","BuildId":"225827","DefinitionId":"141","System.StageName":"Build","operatingSystem":"OSX.1200.ARM64.Open","configuration":"Checked-gcstress0xc_jitminopts_heapverify1","System.JobName":"__default","System.PhaseAttempt":"1","System.StageAttempt":"1","System.JobId":"4b5575ba-4f05-5198-bc88-a075c735caa5","BuildNumber":"20230402.1","CollectionUri":"https://dev.azure.com/dnceng-public/","System.PhaseName":"run_test_p1_Composite_osx_arm64_checked","DefinitionName":"runtime-coreclr crossgen2-composite gcstress","architecture":"arm64","System.JobAttempt":"1","AzurePipelinesTestRunId":"4245858","Reason":"Schedule"} Schedule
2023-04-03T08:02:24.917Z runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitminopts_heapverify1 osx.1200.arm64.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"Project":"public","BuildId":"225827","DefinitionId":"141","System.StageName":"Build","operatingSystem":"OSX.1200.ARM64.Open","configuration":"Checked-gcstress0xc_jitminopts_heapverify1","System.JobName":"__default","System.PhaseAttempt":"1","System.StageAttempt":"1","System.JobId":"4b5575ba-4f05-5198-bc88-a075c735caa5","BuildNumber":"20230402.1","CollectionUri":"https://dev.azure.com/dnceng-public/","System.PhaseName":"run_test_p1_Composite_osx_arm64_checked","DefinitionName":"runtime-coreclr crossgen2-composite gcstress","architecture":"arm64","System.JobAttempt":"1","AzurePipelinesTestRunId":"4245858","Reason":"Schedule"} Schedule
2023-04-03T08:02:24.917Z runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitminopts_heapverify1 osx.1200.arm64.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"Project":"public","BuildId":"225827","DefinitionId":"141","System.StageName":"Build","operatingSystem":"OSX.1200.ARM64.Open","configuration":"Checked-gcstress0xc_jitminopts_heapverify1","System.JobName":"__default","System.PhaseAttempt":"1","System.StageAttempt":"1","System.JobId":"4b5575ba-4f05-5198-bc88-a075c735caa5","BuildNumber":"20230402.1","CollectionUri":"https://dev.azure.com/dnceng-public/","System.PhaseName":"run_test_p1_Composite_osx_arm64_checked","DefinitionName":"runtime-coreclr crossgen2-composite gcstress","architecture":"arm64","System.JobAttempt":"1","AzurePipelinesTestRunId":"4245858","Reason":"Schedule"} Schedule
2023-04-03T08:02:24.917Z runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitminopts_heapverify1 osx.1200.arm64.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"Project":"public","BuildId":"225827","DefinitionId":"141","System.StageName":"Build","operatingSystem":"OSX.1200.ARM64.Open","configuration":"Checked-gcstress0xc_jitminopts_heapverify1","System.JobName":"__default","System.PhaseAttempt":"1","System.StageAttempt":"1","System.JobId":"4b5575ba-4f05-5198-bc88-a075c735caa5","BuildNumber":"20230402.1","CollectionUri":"https://dev.azure.com/dnceng-public/","System.PhaseName":"run_test_p1_Composite_osx_arm64_checked","DefinitionName":"runtime-coreclr crossgen2-composite gcstress","architecture":"arm64","System.JobAttempt":"1","AzurePipelinesTestRunId":"4245858","Reason":"Schedule"} Schedule
2023-04-03T08:02:24.917Z runtime-coreclr crossgen2-composite gcstress Checked-gcstress0xc_jitminopts_heapverify1 osx.1200.arm64.open arm64 Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite/CctorForWrite.sh Failed {"Project":"public","BuildId":"225827","DefinitionId":"141","System.StageName":"Build","operatingSystem":"OSX.1200.ARM64.Open","configuration":"Checked-gcstress0xc_jitminopts_heapverify1","System.JobName":"__default","System.PhaseAttempt":"1","System.StageAttempt":"1","System.JobId":"4b5575ba-4f05-5198-bc88-a075c735caa5","BuildNumber":"20230402.1","CollectionUri":"https://dev.azure.com/dnceng-public/","System.PhaseName":"run_test_p1_Composite_osx_arm64_checked","DefinitionName":"runtime-coreclr crossgen2-composite gcstress","architecture":"arm64","System.JobAttempt":"1","AzurePipelinesTestRunId":"4245858","Reason":"Schedule"} Schedule

markples added a commit that referenced this issue Apr 21, 2023
Expand the fix in #80485 to cover helpers including common ones for R2R as well as some generic helpers for JIT.

This would cause regressions (100ks code size in diffs) if done alone, so it also includes checks on whether a helper may trigger a cctor and whether it is beforefieldinit. The precise ordering of the fix is only required for a non-beforefieldinit ctor. This recovers the (small) losses from #80485 and mitigates this fix.

As before, the primary diff is moving type initialization into (for correctness) or out of (the mitigation optimization) a JIT tree. These leads to secondary effects as values may need to be preserved around the type initialization code.

The end result of the fix+mitigations is very little code size change, but viewing the diffs suggests possible future code improvements. However, the impact of any of these should be established first.
- A type initializer will never invoke itself
- When type initialization is removed/CSEed late, it is too late for forward subst/etc., so the loss of the intact tree can still impact code generation
- A custom calling convention for the static helpers (tuned to the common case of no type initialization needing to occur) could help with the impact of calling it in the middle of a calculation
- Code can use beforefieldinit in more place

Fixes #84007
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Apr 21, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm64 arch-x64 arch-x86 area-crossgen2-coreclr blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs os-linux Linux OS (any supported distro) os-mac-os-x macOS aka OSX os-windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants