Skip to content

[browser][CoreCLR][R2R] ManagedWebSocket async close path traps with unreachable #134264

Description

@lewing

Description

The full trimmed browser-Wasm CoreCLR ReadyToRun library-test lane terminates while running System.Net.WebSockets.Tests with RuntimeError: unreachable during R2R/interpreter transitions in the managed WebSocket close path.

Found while bringing up #133193.

Reproduction Steps

Build and run System.Net.WebSockets.Tests for browser-Wasm CoreCLR with:

TestWasmReadyToRun=true
EnableAggressiveTrimming=true
RuntimeFlavor=CoreCLR
Configuration=Release

The failure reproduced in PR #133656, Azure DevOps build 1603190, Helix job 3158c862-61f5-4cf9-bb24-6ecdf2cfe895, work item WasmTestOnChrome-CLR-ST-Batch-5.

Expected behavior

The WebSockets unit tests complete and report xUnit results.

Actual behavior

RuntimeError: unreachable
    at System.Net.WebSockets.ManagedWebSocket.WaitForServerToCloseConnectionAsync(...).MoveNext()
    at WasmInterpreterToR2RThunk(vTp)
    at InvokeManagedMethod(...)
    at WasmR2RToInterpreterThunk(vTp)
    at WasmDelayLoadHelper(...)
    at System.Net.WebSockets.ManagedWebSocket.CloseOutputAsyncCore(...).MoveNext()

Additional frames show repeated R2R-to-interpreter and interpreter-to-R2R transitions through CloseWithReceiveErrorAndThrowAsync.

Regression?

Unknown. This configuration did not previously run the broad WebSockets test assembly with CoreCLR ReadyToRun.

Known Workarounds

Keep only System.Net.WebSockets.Tests.dll interpreted while leaving the product System.Net.WebSockets assembly ReadyToRun compiled.

Configuration

Browser-Wasm CoreCLR Release, aggressively trimmed per-app ReadyToRun, Linux Helix host, Chrome 153.

Other information

The process terminates before xUnit identifies a single failing test. Re-enable test-assembly R2R coverage after the async close transition no longer traps.

Note

This issue was generated with GitHub Copilot assistance and reviewed as part of the #133193 bring-up.

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions