Skip to content

WASM reactor module crashes after garbage collection

Summary

I've been building a Frontend library for Haskell and stumbled upon this bug where my examples crashed randomly when I built them as WASI reactor modules. I created a separate repo with minimal reproducible counterexample, You can open deployed version here and observe the bug in your browser console.

It seems this problem only occurs when program is compiled as WASI reactor with -optl-mexec-model=reactor option. It crashes on next re-entry after a garbage collection operation. Following is contents of stderr, when I enable -dlink -debug +RTS -DS -RTS

uknown.wasm: internal error: Evaluated a CAF (0x13b2a0) that was GC'd!
    (GHC version 9.9.20231020 for wasm32_unknown_wasi)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

Steps to reproduce

  • Open counterexample, turn on browser console and follow instructions on the page
  • Take a look at sources for the counterexample if you interested

Expected behavior

WASI reactor doesn't crash

Environment

  • ghc-wasm-meta (master) c0aa3bb7d88bb6ec809210e17658dd1ed64ba66c
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information