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: ValueFactory attempted to access the Value property of this instance. #100476

Closed
v-wenyuxu opened this issue Apr 1, 2024 · 13 comments · Fixed by #101971
Closed
Assignees
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI blocking-clean-ci-optional Blocking optional rolling runs JitStress CLR JIT issues involving JIT internal stress modes os-mac-os-x macOS aka OSX
Milestone

Comments

@v-wenyuxu
Copy link

Failed in: runtime-coreclr jitstress2-jitstressregs 20240331.1

Failed tests:

coreclr osx arm64 Checked jitstress2_jitstressregs0x80 @ OSX.1200.ARM64.Open
    - JIT/Methodical/eh/basics/throwinclassconstructor_d/throwinclassconstructor_d.dll

Error message:

 ValueFactory attempted to access the Value property of this instance.

Stack trace:

   at System.Threading.ThreadLocal`1.GetValueSlow()
   at Program.<<Main>$>g__TestExecutor273|0_274(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass0_0&)
@v-wenyuxu v-wenyuxu added arch-arm64 os-mac-os-x macOS aka OSX JitStress CLR JIT issues involving JIT internal stress modes blocking-clean-ci-optional Blocking optional rolling runs labels Apr 1, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 1, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 1, 2024
@JulieLeeMSFT JulieLeeMSFT added this to the 9.0.0 milestone Apr 1, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Apr 1, 2024
@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr jitstress2-jitstressregs 20240406.1

Failed tests:

coreclr osx arm64 Checked jitstress2_jitstressregs0x80 @ OSX.1200.ARM64.Open
    - JIT/Methodical/eh/basics/throwinclassconstructor_d/throwinclassconstructor_d.dll

Error message:

 ValueFactory attempted to access the Value property of this instance.

Stack trace:

   at System.Threading.ThreadLocal`1.GetValueSlow()
   at Program.<<Main>$>g__TestExecutor273|0_274(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass0_0&)

@kunalspathak
Copy link
Member

@janvorli - This test passes with DOTNET_LegacyExceptionHandling=1. Assigning to you.

@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr jitstress2-jitstressregs 20240414.1

Failed tests:

coreclr osx arm64 Checked jitstress2_jitstressregs0x80 @ OSX.1200.ARM64.Open
    - JIT/Methodical/eh/basics/throwinclassconstructor_d/throwinclassconstructor_d.dll

Error message:

 ValueFactory attempted to access the Value property of this instance.

Stack trace:

   at System.Threading.ThreadLocal`1.GetValueSlow()
   at Program.<<Main>$>g__TestExecutor273|0_274(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass0_0&)

@janvorli
Copy link
Member

@kunalspathak I am unable to repro it on my Apple M1. I've set COMPlus_TieredCompilation=0 COMPlus_JitStress=2 COMPlus_JitStressRegs=0x80 and ran the ./artifacts/tests/coreclr/osx.arm64.Checked/JIT/Methodical/Methodical_d1/Methodical_d1.sh
Were you able to repro the issue locally?

@janvorli
Copy link
Member

janvorli commented Apr 15, 2024

Actually, the merged tests don't return any error code from the test run, so I've missed that the test is failing. But for me, it is failing quite differently:

  • It reproes with legacy exception handling too
  • It doesn't fail in the test itself, but in the merged tests infrastructure (that actually matches this issue)
  • It doesn't repro if I remove the COMPlus_JitStressRegs=0x80
  • It doesn't repro if I remove the COMPlus_JitStress=2
  • It doesn't repro if I remove the COMPlus_TieredCompilation=0
  • In my case, it fails with:
    System.NullReferenceException: Object reference not set to an instance of an object.
    at Program.<$>g__TestExecutor273|0_274(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass0_0&) in /Users/janvorli/git/runtime/artifacts/tests/coreclr/obj/osx.arm64.Checked/Managed/JIT/Methodical/Methodical_d1/generated/XUnitWrapperGenerator/XUnitWrapperGenerator.XUnitWrapperGenerator/FullRunner.g.cs:line 732

@janvorli
Copy link
Member

janvorli commented Apr 15, 2024

Interestingly, without COMPlus_JitStress=2, it doesn't call the
CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS that is getting the address that we later end up reading "1" from and then attempt to read at an offset from this value, which obviously results in the null reference (in my local run)
It seems that (if I correlated the JIT dumps correctly), without COMPlus_JitStress=2, it ends up calling
System.Threading.ThreadLocal``1[System.__Canon]:get_Value():System.__Canon:this instead.

@kunalspathak
Copy link
Member

Interestingly, without COMPlus_JitStress=2, it doesn't call the CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS that is getting the address that we later end up reading "1" from and then attempt to read at an offset from this value, which obviously results in the null reference (in my local run) It seems that (if I correlated the JIT dumps correctly), without COMPlus_JitStress=2, it ends up calling System.Threading.ThreadLocal1[System.__Canon]:get_Value():System.__Canon:this `` instead.

and what happens when you set DOTNET_LegacyExceptionHandling=1?

@v-wenyuxu
Copy link
Author

Failed in: runtime-coreclr jitstress2-jitstressregs 20240421.1

Failed tests:

coreclr osx arm64 Checked jitstress2_jitstressregs0x80 @ OSX.1200.ARM64.Open
    - JIT/Methodical/eh/basics/throwinclassconstructor_d/throwinclassconstructor_d.dll

Error message:

 ValueFactory attempted to access the Value property of this instance.

Stack trace:

   at System.Threading.ThreadLocal`1.GetValueSlow()
   at Program.<<Main>$>g__TestExecutor273|0_274(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass0_0&)

@janvorli
Copy link
Member

and what happens when you set DOTNET_LegacyExceptionHandling=1

Exactly the same as without it.

@JulieLeeMSFT
Copy link
Member

It is still failing in runtime-coreclr jitstress2-jitstressregs.
@janvorli, so what would be the next step?

@kunalspathak
Copy link
Member

@janvorli
Copy link
Member

janvorli commented May 6, 2024

I can repro it with runfo using the build from your recent link.

janvorli added a commit to janvorli/runtime that referenced this issue May 7, 2024
When I've made a change to optimize the collided exception handling by
copying the stack frame iterator state, I've somehow missed adding two
callee saved registers, x27 and x28 to a list of callee saved registers
and that caused them to not to be copied during the state copying.

It has caused failures in one of the coreclr tests when running with
specific JIT stress settings.

Close dotnet#100476
janvorli added a commit that referenced this issue May 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
When I've made a change to optimize the collided exception handling by
copying the stack frame iterator state, I've somehow missed adding two
callee saved registers, x27 and x28 to a list of callee saved registers
and that caused them to not to be copied during the state copying.

It has caused failures in one of the coreclr tests when running with
specific JIT stress settings.

Close #100476
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this issue May 9, 2024
When I've made a change to optimize the collided exception handling by
copying the stack frame iterator state, I've somehow missed adding two
callee saved registers, x27 and x28 to a list of callee saved registers
and that caused them to not to be copied during the state copying.

It has caused failures in one of the coreclr tests when running with
specific JIT stress settings.

Close dotnet#100476
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this issue May 30, 2024
When I've made a change to optimize the collided exception handling by
copying the stack frame iterator state, I've somehow missed adding two
callee saved registers, x27 and x28 to a list of callee saved registers
and that caused them to not to be copied during the state copying.

It has caused failures in one of the coreclr tests when running with
specific JIT stress settings.

Close dotnet#100476
@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI blocking-clean-ci-optional Blocking optional rolling runs JitStress CLR JIT issues involving JIT internal stress modes os-mac-os-x macOS aka OSX
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants