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: Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd #100751

Closed
v-wenyuxu opened this issue Apr 8, 2024 · 10 comments · Fixed by #105779
Labels
arch-x86 area-Interop-coreclr blocking-clean-ci-optional Blocking optional rolling runs in-pr There is an active PR which will close this issue when it is merged JitStress CLR JIT issues involving JIT internal stress modes os-windows
Milestone

Comments

@v-wenyuxu
Copy link

Failed in: runtime-coreclr jitstress-random 20240407.1

Failed tests:

coreclr windows x86 Checked jitstress_random_2 @ Windows.10.Amd64.Open
    - Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd

Error message:

 
Return code:      1
Raw output file:      C:hwA234091BwAC40094BuploadsIJWCopyConstructorMarshalerCopyConstructorMarshaleroutput.txt
Raw output:
BEGIN EXECUTION
 "C:hwA234091Bpcorerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" -p "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true"  CopyConstructorMarshaler.dll 
Xunit.Sdk.EqualException: Assert.Equal() Failure: Values differ
Expected: 0
Actual:   2
   at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 168
   at CopyConstructorMarshaler.CopyConstructorMarshaler.CopyConstructorsInArgumentStackSlots()
   at __GeneratedMainWrapper.Main()
Registering 00ABE434
Registering copy of 00ABE434 at 00ABE438
Registering copy of 00ABE438 at 00ABE3F4
Unregistering 00ABE438
Registering copy of 00ABE3F4 at 00ABE390
Unregistering 00ABE3F4
Unmanaged: Using relative at address 00ABE390
Unregistering 00ABE390
Unregistering 00ABE434
Registering 00ABE3F8
Registering copy of 00ABE3F8 at 00ABE3E0
Managed: Using relative at address 00ABE3D0
Error: Relative object 00ABE3D0 not registered
 Error: Relative object 00ABE3D0 has invalid relative pointer 00ABE3DC
Unregistering 00ABE3F8
Expected: 100
Actual: 101
END EXECUTION - FAILED
FAILED
Test failed. Trying to see if dump file was created in C:cores since 4/7/2024 8:31:14 PM
Test Harness Exitcode is : 1
To run the test:
Set up CORE_ROOT and run.
> C:hwA234091BwAC40094BeInteropInterop../IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd

Stack trace:

   at TestLibrary.OutOfProcessTest.RunOutOfProcessTest(String assemblyPath)
   at Program.<<Main>$>g__TestExecutor243|25_244(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass25_0&)
@v-wenyuxu v-wenyuxu added arch-x86 os-windows JitStress CLR JIT issues involving JIT internal stress modes blocking-clean-ci-optional Blocking optional rolling runs labels Apr 8, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 8, 2024
@AaronRobinsonMSFT
Copy link
Member

@jkoritzinsky Could this be related to #100050?

@jkoritzinsky
Copy link
Member

Yes, it looks like in this JIT Stress mode, the codegen is introducing additional copies/spills into the IL stub.

This isn't a failure due to changes in that PR, but a bug (at least for that scenario) exposed by the test improvements.

@AaronRobinsonMSFT AaronRobinsonMSFT removed the untriaged New issue has not been triaged by the area owner label Apr 18, 2024
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 9.0.0 milestone Apr 18, 2024
@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr jitstress-random 20240421.1

Failed tests:

coreclr windows x86 Checked jitstress_random_2 @ Windows.10.Amd64.Open
    - Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd

Error message:

 
Return code:      1
Raw output file:      C:hwA1A7089BwB7AA0985uploadsIJWCopyConstructorMarshalerCopyConstructorMarshaleroutput.txt
Raw output:
BEGIN EXECUTION
 "C:hwA1A7089Bpcorerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" -p "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true"  CopyConstructorMarshaler.dll 
Xunit.Sdk.EqualException: Assert.Equal() Failure: Values differ
Expected: 0
Actual:   2
   at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 168
   at Xunit.Assert.Equal[T](T expected, T actual) in /_/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 90
   at CopyConstructorMarshaler.CopyConstructorMarshaler.CopyConstructorsInArgumentStackSlots()
   at __GeneratedMainWrapper.Main()
Registering 0077E194
Registering copy of 0077E194 at 0077E198
Registering copy of 0077E198 at 0077E158
Unregistering 0077E198
Registering copy of 0077E158 at 0077E10C
Unregistering 0077E158
Unmanaged: Using relative at address 0077E10C
Unregistering 0077E10C
Unregistering 0077E194
Registering 0077E158
Registering copy of 0077E158 at 0077E140
Managed: Using relative at address 0077E130
Error: Relative object 0077E130 not registered
 Error: Relative object 0077E130 has invalid relative pointer 0077E13C
Unregistering 0077E158
Expected: 100
Actual: 101
END EXECUTION - FAILED
FAILED
Test failed. Trying to see if dump file was created in C:cores since 4/21/2024 7:51:26 PM
Test Harness Exitcode is : 1
To run the test:
Set up CORE_ROOT and run.
> C:hwA1A7089BwB7AA0985eInteropInterop../IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd

Stack trace:

   at Xunit.Assert.True(Nullable`1 condition, String userMessage) in /_/src/Microsoft.DotNet.XUnitAssert/src/BooleanAsserts.cs:line 146
   at TestLibrary.OutOfProcessTest.RunOutOfProcessTest(String assemblyPath)
   at Program.<<Main>$>g__TestExecutor243|25_244(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass25_0&)

@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr jitstress-random 20240517.1

Failed tests:

coreclr windows x86 Checked jitstress_random_2 @ Windows.10.Amd64.Open
    - Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd

Error message:

 
Return code:      1
Raw output file:      C:hwAF0D0953wAF150979uploadsIJWCopyConstructorMarshalerCopyConstructorMarshaleroutput.txt
Raw output:
BEGIN EXECUTION
 "C:hwAF0D0953pcorerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" -p "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true"  CopyConstructorMarshaler.dll 
Xunit.Sdk.EqualException: Assert.Equal() Failure: Values differ
Expected: 0
Actual:   2
   at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 168
   at Xunit.Assert.Equal[T](T expected, T actual) in /_/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 90
   at CopyConstructorMarshaler.CopyConstructorMarshaler.CopyConstructorsInArgumentStackSlots()
   at __GeneratedMainWrapper.Main()
Registering 00DFE2B8
Registering copy of 00DFE2B8 at 00DFE2BC
Registering copy of 00DFE2BC at 00DFE278
Unregistering 00DFE2BC
Registering copy of 00DFE278 at 00DFE22C
Unregistering 00DFE278
Unmanaged: Using relative at address 00DFE22C
Unregistering 00DFE22C
Unregistering 00DFE2B8
Registering 00DFE278
Registering copy of 00DFE278 at 00DFE260
Managed: Using relative at address 00DFE24C
Error: Relative object 00DFE24C not registered
 Error: Relative object 00DFE24C has invalid relative pointer 00DFE25C
Unregistering 00DFE278
Expected: 100
Actual: 101
END EXECUTION - FAILED
FAILED
Test failed. Trying to see if dump file was created in C:cores since 5/17/2024 5:20:02 PM
Test Harness Exitcode is : 1
To run the test:
Set up CORE_ROOT and run.
> C:hwAF0D0953wAF150979eInteropInterop../IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd

Stack trace:

   at Xunit.Assert.True(Nullable`1 condition, String userMessage) in /_/src/Microsoft.DotNet.XUnitAssert/src/BooleanAsserts.cs:line 146
   at TestLibrary.OutOfProcessTest.RunOutOfProcessTest(String assemblyPath, String testPathPrefix)
   at Program.<<Main>$>g__TestExecutor244|25_245(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass25_0&)

@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr jitstress-random 20240729.1

Failed tests:

coreclr windows x86 Checked jitstress_random_2 @ Windows.10.Amd64.Open
    - Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd

Error message:

 
Return code:      1
Raw output file:      C:hwCF4C0ABBwA99F0979uploadsIJWCopyConstructorMarshalerCopyConstructorMarshaleroutput.txt
Raw output:
BEGIN EXECUTION
 "C:hwCF4C0ABBpcorerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" -p "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true"  CopyConstructorMarshaler.dll 
Xunit.Sdk.EqualException: Assert.Equal() Failure: Values differ
Expected: 0
Actual:   2
   at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 168
   at Xunit.Assert.Equal[T](T expected, T actual) in /_/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 90
   at CopyConstructorMarshaler.CopyConstructorMarshaler.CopyConstructorsInArgumentStackSlots()
   at __GeneratedMainWrapper.Main()
Registering 0357E4D0
Registering copy of 0357E4D0 at 0357E4D4
Registering copy of 0357E4D4 at 0357E490
Unregistering 0357E4D4
Registering copy of 0357E490 at 0357E444
Unregistering 0357E490
Unmanaged: Using relative at address 0357E444
Unregistering 0357E444
Unregistering 0357E4D0
Registering 0357E490
Registering copy of 0357E490 at 0357E478
Managed: Using relative at address 0357E464
Error: Relative object 0357E464 not registered
 Error: Relative object 0357E464 has invalid relative pointer 0357E474
Unregistering 0357E490
Expected: 100
Actual: 101
END EXECUTION - FAILED
FAILED
Test failed. Trying to see if dump file was created in C:cores since 7/30/2024 4:26:29 PM
Test Harness Exitcode is : 1
To run the test:
Set up CORE_ROOT and run.
> C:hwCF4C0ABBwA99F0979eInteropInterop../IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/CopyConstructorMarshaler.cmd

Stack trace:

   at Xunit.Assert.True(Nullable`1 condition, String userMessage) in /_/src/Microsoft.DotNet.XUnitAssert/src/BooleanAsserts.cs:line 146
   at TestLibrary.OutOfProcessTest.RunOutOfProcessTest(String assemblyPath, String testPathPrefix)
   at Program.<<Main>$>g__TestExecutor245|25_246(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass25_0&)

@jkoritzinsky
Copy link
Member

I finally had a chance to look at this. I'm still investigating exactly what is causing the failure, but I've finally narrowed it down to exactly which function and stress modes.

The failure is due to the combination of STRESS_GENERIC_VARN and STRESS_UNSAFE_BUFFER_CHECKS causing an extra (unrecorded) copy in the Reverse P/Invoke stub (where we implemented the marshalling as ldarga instead of a custom-emitted assembly wrapper stub), breaking the feature added in #100050.

@jkoritzinsky
Copy link
Member

I've isolated the problem into a non-stress scenario.

When a struct is attributed with UnsafeValueTypeAttribute (which is the case when it has a C-array field), the JIT wants to emit GS cookie checks around the buffer for safety. However, these GS cookie checks (and the related stack spilling/reordering) cause extra copies of the struct that were not expected.

@jkoritzinsky
Copy link
Member

This issue should still be closed as there is a fix in 9.0

@amanasifkhalid
Copy link
Member

Hi @jkoritzinsky, we're still hitting this failure in runtime-coreclr jitstress (example run). Should we reopen this issue, or start a new one? Thanks!

@jkoritzinsky
Copy link
Member

It looks like it's a different JitStress failure (JitStress 2) so we can use the other issue that was opened to track it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86 area-Interop-coreclr blocking-clean-ci-optional Blocking optional rolling runs in-pr There is an active PR which will close this issue when it is merged JitStress CLR JIT issues involving JIT internal stress modes os-windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants