Skip to content

AF: *(_UNCHECKED_OBJECTREF *)handle == NULL (HndCreateHandle called by getJitHandleForObject) #117138

Open

Description

@SakeTao

Failed in: runtime-coreclr gcstress-extra 20250629.1

Failed tests:

coreclr osx arm64 Checked gcstress0xc_disabler2r @ OSX.13.Arm64.Open
    - JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649/DevDiv_461649.cmd

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1081377&view=results
Build error leg or test failing:

Error Message

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

{
  "ErrorMessage": "*(_UNCHECKED_OBJECTREF *)handle == NULL",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎
Result validation: ⚠️ Validation could not be done without an Azure DevOps build URL on the issue. Please add it to the "Build: 🔎" line.
Validation performed at: 9/28/2025 6:05:32 PM UTC

Report

💡 View the full list of hits in the Build Insights portal

Build Repository Branch Test Pull Request
1694950 dotnet/runtime main System.Collections.Concurrent.Tests.WorkItemExecution #138001
1693594 dotnet/runtime main System.Text.Json.Tests.WorkItemExecution
1693367 dotnet/runtime main System.Threading.Tasks.Parallel.Tests.WorkItemExecution #138055
1689031 dotnet/runtime main System.Memory.Tests.WorkItemExecution #137713
1688537 dotnet/runtime release/11.0 System.Linq.Tests.WorkItemExecution #137437
1686199 dotnet/runtime release/10.0 System.Runtime.Numerics.Tests.WorkItemExecution #137768
1686224 dotnet/runtime main System.Private.Xml.Tests.WorkItemExecution #137769
1686069 dotnet/runtime main System.Globalization.Tests.WorkItemExecution #137670
1682196 dotnet/runtime main System.Text.RegularExpressions.Tests.WorkItemExecution
1681617 dotnet/runtime main OutOfProcessTest.JIT/Regression_2/Runtime_69612/Runtime_69612/Runtime_69612.cmd
1680765 dotnet/runtime main ComInterfaceGenerator.Unit.Tests.WorkItemExecution #137523
1680221 dotnet/runtime main System.Text.Json.Tests.WorkItemExecution #137510
1679768 dotnet/runtime main System.Reflection.Tests.WorkItemExecution #137458
1679459 dotnet/runtime main System.Reflection.Tests.WorkItemExecution #137144
1672437 dotnet/runtime main System.IO.Compression.Brotli.Tests.WorkItemExecution
1669975 dotnet/runtime main System.Runtime.Numerics.Tests.WorkItemExecution #137045
1669923 dotnet/runtime main System.Reflection.Tests.WorkItemExecution #136937
1669845 dotnet/runtime main System.Reflection.Tests.WorkItemExecution
1666610 dotnet/runtime OutOfProcessTest.readytorun\DynamicMethodGCStress\DynamicMethodGCStress\DynamicMethodGCStress.cmd #137046
1663485 dotnet/runtime System.Linq.Tests.WorkItemExecution #133483
1663305 dotnet/runtime OutOfProcessTest.JIT/opt/OSR/tailrecurse/tailrecurse.cmd #135794
1661405 dotnet/runtime LibraryImportGenerator.Unit.Tests.WorkItemExecution #136166
1661110 dotnet/runtime System.Memory.Tests.WorkItemExecution #136847
1659594 dotnet/runtime System.Runtime.Numerics.Tests.WorkItemExecution #136830
1658811 dotnet/runtime OutOfProcessTest.JIT/Directed/tls/TestTLSWithLoadedDlls/TestTLSWithLoadedDlls.cmd #135794
1658693 dotnet/runtime System.Private.Xml.Tests.WorkItemExecution #136784
1657880 dotnet/runtime System.Text.Json.Tests.WorkItemExecution #136755
1656429 dotnet/runtime System.Runtime.Numerics.Tests.WorkItemExecution #136562
1655664 dotnet/runtime System.Threading.Tasks.Parallel.Tests.WorkItemExecution #136513
1653325 dotnet/runtime JIT\opt\OSR\pinnedlocal\pinnedlocal.cmd #136606
1653154 dotnet/runtime ComInterfaceGenerator.Unit.Tests.WorkItemExecution #136593
1651259 dotnet/runtime System.Runtime.Numerics.Tests.WorkItemExecution
1649854 dotnet/runtime JIT/opt/OSR/doublestackalloc/doublestackalloc.cmd #136412
1649816 dotnet/runtime Loader.WorkItemExecution
1649869 dotnet/runtime System.Text.Json.Tests.WorkItemExecution #136438

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 5 35

Activity

  1. added
    os-macos
    blocking-clean-ci-optional
    on Jun 30, 2025
  2. added
    untriaged
    on Jun 30, 2025
  3. added
    needs-area-label
    on Jun 30, 2025
  4. added
    area-CodeGen-coreclr
    on Jul 7, 2025
  5. removed
    needs-area-label
    on Jul 7, 2025
  6. removed
    untriaged
    on Jul 14, 2025
  7. added this to the 10.0.0 milestone on Jul 14, 2025
  8. added
    Known Build Error
    on Jul 28, 2025
  9. amanasifkhalid commented on Jul 28, 2025

    @amanasifkhalid
    Contributor

    This hasn't hit in the last few runs. Removing blocking-optional tag.

  10. removed
    blocking-clean-ci-optional
    on Jul 28, 2025
  11. 24 remaining items

  12. added
    blocking-clean-ci-optional
    on Jun 8, 2026
  13. JulieLeeMSFT commented on Jul 9, 2026

    @JulieLeeMSFT
    Member

    Failed in (1):

    Console Log: Console Log
    Source: runtime-coreclr libraries-pgo / net11.0-windows-Release-x64-jitosr_stress-Windows.10.Amd64.Open / System.Runtime.Numerics.Tests

    Failed tests:

    - net11.0-windows-Release-x64-jitosr_stress-Windows.10.Amd64.Open
      - System.Runtime.Numerics.Tests
    

    Error Message:

    Assert failure(PID 9492 [0x00002514], Thread: 11336 [0x2c48]): *(_UNCHECKED_OBJECTREF *)handle == NULL
    
    CORECLR! HndCreateHandle + 0x21D (0x00007ffe`3767566d)
    CORECLR! GCHandleStore::CreateHandleOfType + 0xBF (0x00007ffe`3768191f)
    CORECLR! Thread::SetLastThrownObject + 0x3CD (0x00007ffe`3724be6d)
    CORECLR! Thread::SafeSetThrowables + 0x207 (0x00007ffe`3724a6f7)
    CORECLR! NotifyExceptionPassStarted + 0xB2 (0x00007ffe`3765c8c2)
    CORECLR! SfiInitWorker + 0x165 (0x00007ffe`3765de85)
    CORECLR! SfiInit + 0x23F (0x00007ffe`37661b2f)
    SYSTEM.PRIVATE.CORELIB! <no symbol> + 0x0 (0x00007ffe`359819d7)
    SYSTEM.PRIVATE.CORELIB! <no symbol> + 0x0 (0x00007ffe`359817cb)
    CORECLR! UnmanagedCallersOnlyCaller::InvokeDirect<unsigned long,ExInfo *> + 0x1E8 (0x00007ffe`37075eb8)
        File: D:\a\_work\1\s\src\coreclr\gc\handletable.cpp:306
        Image: C:\h\w\AC280905\p\dotnet.exe
    
  14. VincentBu commented on Jul 13, 2026

    @VincentBu
    Contributor

    Failed in: runtime-coreclr libraries-jitstress2-jitstressregs 20260711.1

    Failed tests:

    net11.0-linux-Release-x64-jitstress2_jitstressregs0x10-AzureLinux.3.Amd64.Open
    - System.Reflection.MetadataLoadContext.Tests Work Item
    
    

    Error message:

    ASSERT FAILED
    	Expression: *(_UNCHECKED_OBJECTREF *)handle == NULL
    	Location:   /__w/1/s/src/coreclr/gc/handletable.cpp:306
    	Function:   HndCreateHandle
    	Process:    38944
    [createdump] Gathering state for process 38944 dotnet
    [createdump] Crashing thread 9837 signal 5 (0005)
    [createdump] Writing crash report to file /datadisks/disk1/dumps/coredump.38944.dmp.crashreport.json
    [createdump] Crash report successfully written
    [createdump] Writing minidump with heap to file /datadisks/disk1/dumps/coredump.38944.dmp
    [createdump] Written 201654272 bytes (49232 pages) to core file
    [createdump] Target process is alive
    [createdump] Dump successfully written in 1063ms
    waitpid() returned successfully (wstatus 00000000) WEXITSTATUS 0 WTERMSIG 0
    ./RunTests.sh: line 175: 38944 Aborted                 (core dumped) "$RUNTIME_PATH/dotnet" exec --runtimeconfig System.Reflection.MetadataLoadContext.Tests.runtimeconfig.json --depsfile System.Reflection.MetadataLoadContext.Tests.deps.json xunit.console.dll System.Reflection.MetadataLoadContext.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing $RSP_FILE
    /datadisks/disk1/work/BD7C09D2/w/ACBC094D/e
    ----- end Sat Jul 11 09:59:51 AM UTC 2026 ----- exit code 134 ----------------------------------------------------------
    
  15. VincentBu commented on Sep 8, 2026

    @VincentBu
    Contributor

    Failed in: runtime-coreclr gcstress-extra 20260906.1

    Failed tests:

    coreclr osx arm64 Checked gcstress0xc_jitstress2 @ OSX.26.Arm64.Open
    - JIT/Regression/JitBlue/DevDiv_461649/DevDiv_461649/DevDiv_461649.cmd
    
    

    Error message:

    ASSERT FAILED
    	Expression: *(_UNCHECKED_OBJECTREF *)handle == NULL
    	Location:   /Users/runner/work/1/s/src/coreclr/gc/handletable.cpp:301
    	Function:   HndCreateHandle
    	Process:    2120
    /private/tmp/helix/working/B09D09D3/w/9FB30918/e/JIT/Regression/Regression_3/../JitBlue/DevDiv_461649/DevDiv_461649/DevDiv_461649.sh: line 462:  2120 Trace/BPT trap: 5       (core dumped) $LAUNCHER $ExePath "${CLRTestExecutionArguments[@]}"
    
    Return code:      1
    Raw output file:      /tmp/helix/working/B09D09D3/w/9FB30918/uploads/JitBlue/DevDiv_461649/DevDiv_461649/output.txt
    Raw output:
    BEGIN EXECUTION
    /tmp/helix/working/B09D09D3/p/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false -p System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true DevDiv_461649.dll ''
    Expected: 100
    Actual: 133
    END EXECUTION - FAILED
    Test Harness Exitcode is : 1
    To run the test:
    Set up CORE_ROOT and run.
    > /private/tmp/helix/working/B09D09D3/w/9FB30918/e/JIT/Regression/Regression_3/../JitBlue/DevDiv_461649/DevDiv_461649/DevDiv_461649.sh
    

    Stack trace:

    at TestLibrary.OutOfProcessTest.RunOutOfProcessTest(String assemblyPath, String testPathPrefix) in /__w/1/s/src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs:line 82
       at Program.<<Main>$>g__TestExecutor108|0_109(StreamWriter tempLogSw, StreamWriter statsCsvSw, StreamWriter outOfProcessPlanWriter, <>c__DisplayClass0_0&)
    
  16. added
    Priority:1
    on Nov 2, 2026
  17. pcshrosbree commented on Nov 20, 2026

    @pcshrosbree
    Contributor

    TL;DR: EgorBo's repro still fails on recent main, and the ~CEEInfo change from #125350 stopped it in my runs (0 of 500 on osx-arm64). Would a PR with just that change and a short regression test be welcome, or would you rather revive #125350?

    I hit this assert twice while running Runtime_135463 from the Regressions tests under DOTNET_GCStress=0xC with tiered compilation on: once on osx-arm64 Checked and once on windows-arm64 Checked (main at 8fef9c3). On Windows, the native stack between SfiInit and HndCreateHandle matches the July 9 report. It includes NotifyExceptionPassStarted, Thread::SafeSetThrowables and Thread::SetLastThrownObject. Both hits are in the allocation that found the slot dirty, so they don't show which earlier free left it dirty, or whether that free raced with the GC.

    The repro above still fails at that commit. On osx-arm64 Checked, with DOTNET_TieredCompilation=0 and DOTNET_GCHeapHardLimit=0x1000000 (0x100000 fails GC initialization on that machine), 223 of 500 runs failed on an assert. The outputs I kept show two: *(_UNCHECKED_OBJECTREF *)handle == NULL in HndCreateHandle, and HndIsNullOrDestroyedHandle(...) in BlockFreeHandlesInMask. With the ~CEEInfo change from #125350, 0 of 500 runs failed.

    #125350 was closed for inactivity. @jakobbotsch, @EgorBo: would a PR with just the ~CEEInfo part be welcome as a first step? I have it ready, with a regression test (a two-second loop) that asserts in 20 of 30 runs without the change and 0 of 30 with it. It would not cover the rest of #125350: cooperative mode at the other DestroyHandle callers, and the locked variant for threads that cannot switch modes. If either of you would rather pick #125350 back up, I'm glad to leave it.

  18. jkotas commented on Nov 20, 2026

    @jkotas
    Member

    would a PR with just the ~CEEInfo part be welcome as a first step?

    Yes, a PR that handles the easy cases (just add GCX_COOP call, or fixup the contracts) of switching to cooperative mode around DestroyHandle calls would be welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GCStressKnown Build ErrorPriority:1area-CodeGen-coreclrblocking-clean-ciblocking-clean-ci-optional

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions