Skip to content

AV in System.Threading.Tests failing with JitStress #112683

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

Closed
kunalspathak opened this issue Feb 19, 2025 · 3 comments
Closed

AV in System.Threading.Tests failing with JitStress #112683

kunalspathak opened this issue Feb 19, 2025 · 3 comments
Assignees
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI JitStress CLR JIT issues involving JIT internal stress modes os-windows
Milestone

Comments

@kunalspathak
Copy link
Member

Failing pipeline: https://dev.azure.com/dnceng-public/public/_build/results?buildId=953637&view=ms.vss-test-web.build-test-results-tab&runId=25356914&resultId=217333&paneView=debug

DOTNET_JitStress=159
DOTNET_TieredCompilation=0

C:\h\w\ABD309CB\w\98D40880\e>"C:\h\w\ABD309CB\p\dotnet.exe" exec --runtimeconfig System.Threading.Tests.runtimeconfig.json --depsfile System.Threading.Tests.deps.json xunit.console.dll System.Threading.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing  
  Discovering: System.Threading.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Threading.Tests (found 291 of 303 test cases)
  Starting:    System.Threading.Tests (parallel test collections = on [2 threads], stop on fail = off)
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Threading.Tests.MutexTests.NamedMutex_DisposeWhenLockedRaceTest()
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(System.Object, IntPtr*)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(System.Object, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at Xunit.Sdk.TestInvoker`1+<>c__DisplayClass47_0+<<InvokeTestMethodAsync>b__1>d[[System.__Canon, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Xunit.Sdk.TestInvoker`1+<>c__DisplayClass47_0+<<InvokeTestMethodAsync>b__1>d[[System.__Canon, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], xunit.execution.dotnet, Version=2.9.2.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c]](<<InvokeTestMethodAsync>b__1>d<System.__Canon> ByRef)
@kunalspathak kunalspathak added arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-windows labels Feb 19, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Feb 19, 2025
Copy link
Contributor

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

@kunalspathak kunalspathak self-assigned this Feb 19, 2025
@jkotas jkotas added the JitStress CLR JIT issues involving JIT internal stress modes label Feb 19, 2025
@jkotas jkotas changed the title System.Threading.Tests failing with AV AV in System.Threading.Tests failing with JitStress Feb 19, 2025
@JulieLeeMSFT JulieLeeMSFT removed the untriaged New issue has not been triaged by the area owner label Feb 19, 2025
@JulieLeeMSFT JulieLeeMSFT added this to the 10.0.0 milestone Feb 19, 2025
@kunalspathak
Copy link
Member Author

kunalspathak commented Feb 19, 2025

IN0001: 000008      movz    x0, #0xD3A0
IN0002: 00000C      movk    x0, #0xF831 LSL #16
IN0003: 000010      movk    x0, #0x7FFC LSL #32
IN0004: 000014      bl      CORINFO_HELP_NEWSFAST
IN0005: 000018      mov     x1, xzr
IN0006: 00001C      mov     w2, #123
IN0007: 000020      swpalb  w2, w1, [x1]  ;  <-- AV because 2 lines above `x1 == 0`
IN0008: 000024      sxtb    w1, w1
IN0009: 000028      strb    w1, [x0, #0x08]

Edit: The test case that is failing is and it does operate on null and expect to throw. Investigating why it doesn't surface as NullReferenceException instead of AV.

Assert.Throws<NullReferenceException>(() => Interlocked.Exchange(ref Unsafe.NullRef<sbyte>(), 123));

@kunalspathak
Copy link
Member Author

This is same problem as #112709 and fixed in #112711.

 After syncing with Main, the issue disappears as seen below (left= bug, right= main)

Image

@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2025
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 JitStress CLR JIT issues involving JIT internal stress modes os-windows
Projects
None yet
Development

No branches or pull requests

3 participants