Skip to content

[Bug]: WASM client aborts after linear memory reaches the 2 GiB wasm32 limit #103

Description

@Mat4m0

Problem area

Crash or unexpected quit

What happened?

We've observed a reproducible renderer abort after the WebAssembly linear memory backing the game reaches exactly 2,147,483,648 bytes (2 GiB).

This appears to be an upstream wasm32 limitation rather than an Electron or harness issue. We should track the upstream dependency and investigate available fixes or workarounds.

Evidence

A diagnostics bundle captured the following:

  • renderer.wasm.abort
  • reasonKind: "assertion"
  • fingerprint: 99d845da

Immediately before the abort:

  • socket.rendererPeakSourceBackingBytes = 2147483648
  • renderer RSS plateaued around 2.4–2.5 GB
  • Electron remained healthy
  • no renderer stalls
  • no presentation failures
  • no fatal snapshot/read errors
  • normal networking

The only notable anomaly was the WASM linear memory reaching exactly 2 GiB.

After the abort:

  • the WASM module tore down
  • renderer memory dropped from roughly 2.5 GB to 1.1 GB
  • the shell remained alive and presented the crash UI

Why this looks related

The peak backing size is exactly 2^31, which is the practical boundary where wasm32 implementations commonly run into signed 32-bit pointer/size arithmetic issues.

This is not proof that the assertion was caused by the limit—the assertion text is intentionally stripped before crossing IPC—but it is the only strong signal in the diagnostics.

Current limitations

The diagnostics intentionally preserve only:

  • abort kind
  • fingerprint

The original assertion text is lost once the renderer exits, making root-cause confirmation impossible after the fact.

Proposed work

  • Track the upstream issue around wasm32's 2 GiB linear memory limit.
  • Determine whether a newer upstream runtime/toolchain removes or raises this limitation.
  • Investigate whether Memory64 or another upstream migration is planned.
  • If no upstream fix exists, determine whether we should proactively detect approaching 2 GiB usage and restart or recycle before the limit is reached.
  • If this reproduces again, capture the DevTools console before quitting so the original assertion message can be correlated with fingerprint 99d845da.

Steps to reproduce (optional)

No response

Diagnostics (optional)

No response

Mac and macOS version (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstreamIssue not fixable in our codebase

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions