Skip to content

[wasi][coreclr] Library tests crash with "call stack exhausted" #134950

Description

@lewing

Description

On CoreCLR WASI, some library test suites crash with wasm trap: call stack exhausted:

  • System.Threading.Tasks.Dataflow.Tests: the trap occurs in a long chain of task continuations (Task.NotifyDebuggerOfWaitCompletionIfNecessary ← ContinuationResultTaskFromTask<__Canon>.InnerInvoke ← WasmVirtualDispatchThunk ← ExecutionContext.RunInternal ← Task.ExecuteWithThreadLocal ...).
  • System.Text.RegularExpressions.Unit.Tests: deep recursion in RegexNode.FindAndMakeLoopsAtomic (→ RegexNode.ChildCount → CastHelpers.IsInstanceOfAny → StaticsHelpers.GetGCStaticBase).

Both run the same code paths on other platforms, including browser, without exhausting the stack. On WASI the wasm call stack available to CoreCLR, and the per-frame cost of R2R code and the interpreter transition thunks, may leave less headroom. Check:

  • the configured stack size for the wasihost corerun link and for wasmtime (-W max-wasm-stack);
  • whether RuntimeHelpers.EnsureSufficientExecutionStack/TryEnsureSufficientExecutionStack, which the regex code uses to avoid deep recursion, reports the real remaining stack on WASI.

Seen in trimmed ReadyToRun runs of the CoreCLR WASI library tests for #134813.

Note

This issue was drafted with the help of GitHub Copilot.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions