You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Description
On CoreCLR WASI, some library test suites crash with
wasm trap: call stack exhausted:Task.NotifyDebuggerOfWaitCompletionIfNecessary←ContinuationResultTaskFromTask<__Canon>.InnerInvoke←WasmVirtualDispatchThunk←ExecutionContext.RunInternal←Task.ExecuteWithThreadLocal...).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:
corerunlink and for wasmtime (-W max-wasm-stack);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.