Skip to content

[WASI][CoreCLR] wasm trap: uninitialized element #133240

Closed

Description

@pavelsavara

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1582547
Build error leg or test failing: WASI CoreCLR

Error Message

Log

wasmtime run -W exceptions=y -S http --dir /root/helix/work/workitem/e/JIT/Generics/JIT.Generics::/ --dir /root/helix/work/correlation::/core --env CORE_ROOT=/core --env DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true --env DOTNET_WASI_PRINT_EXIT_CODE=1 /root/helix/work/correlation/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false -p System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true JIT.Generics.dll ''
Error: failed to run main module `/root/helix/work/correlation/corerun`

Caused by:
    0: failed to invoke `run` function
    1: error while executing at wasm backtrace:
    0: 0x1c918e - corerun!InvokeUnmanagedCalli(unsigned long, void (*)(unsigned long, signed char*, signed char*), signed char*, signed char*)
    1: 0x16fee9 - corerun!InvokeUnmanagedCalliWithTransition(unsigned long, void (*)(unsigned long, signed char*, signed char*), signed char*, InterpMethodContextFrame*, signed char*, signed char*)
    2: 0x176119 - corerun!InterpExecMethod(InterpreterFrame*, InterpMethodContextFrame*, InterpThreadContext*, ExceptionClauseArgs*)
    3: 0x1c6070 - corerun!ExecuteInterpretedMethod
    4: 0x1c6b05 - corerun!ExecuteInterpretedMethodFromUnmanaged
    5: 0x2fc212 - corerun!Call_System_Private_CoreLib_System_Environment_CallEntryPoint_I32_I32_I32_I32_I32_RetVoid(void*, void*, void*, int, void*)
    6: 0x2e201f - corerun!void UnmanagedCallersOnlyCaller::InvokeThrowing<long, PtrArray**, int*, bool>(long, PtrArray**, int*, bool)
    7: 0x2e1dec - corerun!RunMain(MethodDesc*, int*, PtrArray**, bool)
    8: 0x2e2396 - corerun!Assembly::ExecuteMainMethod(PtrArray**, bool)
    9: 0x1ab02f - corerun!CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*)
   10: 0x2fa964 - corerun!coreclr_execute_assembly
   11:  0x5487d - corerun!main
   12:   0xce6a - corerun!__main_void
   13:   0xcd63 - corerun!_start
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
    2: wasm trap: uninitialized element
{
  "ErrorMessage": "uninitialized element",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1582547
Error message validated: [uninitialized element]
Result validation: ❌ Known issue did not match with the provided build.
Validation performed at: 9/4/2026 3:14:17 PM UTC

Report

Build Repository Test Pull Request
1645826 dotnet/runtime reflection.WorkItemExecution #136259
1620394 dotnet/runtime reflection.WorkItemExecution #134966
1618574 dotnet/runtime reflection.WorkItemExecution #134966
1617446 dotnet/runtime jit64_5.WorkItemExecution #134813

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 1 4

Activity

  1. added this to the 12.0.0 milestone on Sep 4, 2026
  2. self-assigned this
    on Sep 4, 2026
  3. added
    arch-wasmWebAssembly architecture
    Known Build ErrorUse this to report build issues in the .NET Helix tab
    os-wasiRelated to WASI variant of arch-wasm
    on Sep 4, 2026
  4. added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Sep 4, 2026
  5. dotnet-policy-service commented on Sep 4, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
    See info in area-owners.md if you want to be subscribed.

  6. dotnet-policy-service commented on Sep 4, 2026

    @dotnet-policy-service
    Contributor

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

  7. lewing commented on Oct 27, 2026

    @lewing
    Member

    Analysis

    Mechanism. On WASI, an unmanaged calli (which is how P/Invoke and QCall IL stubs make their calls) needs a thunk from the checked-in src/coreclr/vm/wasm/wasi/callhelpers-*.cpp tables. When the signature is missing, ComputeCalliSigThunk returns NULL (src/coreclr/vm/wasm/helpers.cpp). In Release the _ASSERT is compiled out, so InvokeUnmanagedCalli calls through table slot 0 and wasmtime reports wasm trap: uninitialized element.

    Every hit I could trace was a PR whose thunk tables were stale at the time:

    Build PR Hit Tables regenerated
    1582547 (original) #133000 Sep 4 09:51 #133239 (regenerated WASI call helpers), merged Sep 4 19:04
    1617446 #134813 Sep 30 in-PR commit touching callhelpers-pinvoke.cpp, Oct 3
    1618574, 1620394 #134966 Oct 1 and Oct 2 02:48 in-PR commit "Refresh WebAssembly interpreter thunk for emitted method IL", Oct 2 18:24
    1645826 #136259 Oct 22 unrelated, see below

    The Helix logs for 1617446, 1618574, and 1620394 have expired, so those three rows are a timing match rather than confirmed stacks.

    The latest hit (1645826) is a different failure. It traps in NativeImage::~NativeImage in the R2R lane, where that PR broke 25 of 26 work items (crossgen2 asserts, unreachable traps). It matched only because this issue's error text is just uninitialized element.

    Prevention. Since #135156 (Oct 7), wasm-coreclr-callhelpers-check.yml regenerates the tables in CI and fails any PR whose checked-in call helpers are stale, so this can no longer reach main. A PR can still hit the trap in its own test legs before it regenerates; the CI check will flag that PR.

    Better reporting for a missing thunk, instead of a null-slot trap, is tracked by #133124.

    Closing, since the root cause is fixed and now guarded by CI.

    Note

    This comment was generated with the assistance of GitHub Copilot.

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

Metadata

Metadata

Labels

Known Build ErrorUse this to report build issues in the .NET Helix tabarch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIos-wasiRelated to WASI variant of arch-wasm

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions