Skip to content

--safe: running an --experimental-napi package by registry name kills libuv callback dispatch; local path works #94

Description

@spichen

Summary

Under edge --safe, event-loop callbacks do not dispatch. Sync code and microtasks run, but setTimeout, setImmediate, async fs, and similar callbacks are silent.

  • Registry package name: callbacks do not dispatch.
  • Local WEBc file with identical bytes: callbacks dispatch normally.

Native edge is fine. Same Wasmer, same package, same --experimental-napi flag.

Minimal Repro

wasmer package download wasmer/edgejs@0.0.0-4ad8137 --out-path edge.webc

# registry NAME -> timer never fires
wasmer run --experimental-napi wasmer/edgejs@=0.0.0-4ad8137 -- \
  -e "setTimeout(() => process.exit(42), 50)"; echo $?   # 0

# same bytes, LOCAL file -> timer fires
wasmer run --experimental-napi ./edge.webc -- \
  -e "setTimeout(() => process.exit(42), 50)"; echo $?   # 42

Observed

  • setTimeout(() => process.exit(42), 50) exits 0.
  • A two-timer re-arm exits 0.
  • Async fs.readFile exits 0.
  • setImmediate(() => process.exit(42)) stays alive without dispatching the callback.
  • edge --safe -e "setTimeout(() => process.exit(42), 50)" exits 0.

The same cases work from ./edge.webc; timer/immediate probes exit 42, and async fs.readFile fires its callback.

Expected

wasmer run <registry-name> should dispatch callbacks the same way wasmer run <local-file> does when both refer to the same --experimental-napi package bytes.

Notes

A setTimeout(cb, 2000) keeps the process alive for roughly 2 seconds, but the callback is not dispatched. So the clock wait appears to return on time; the JS callback just never runs.

  • Not the package bytes: the downloaded local WEBc works.
  • Not guest network or mounted volumes: the minimal repro above uses neither.
  • Not only edge --safe: direct wasmer run --experimental-napi <registry-name> reproduces it.

Workaround

edge --safe --wasmer-package ./edge.webc dispatches callbacks correctly. A .webc dir or EDGE_WASMER_PACKAGE should follow the same local-package path.

Environment

  • Edge.js: v24.13.2-pre
  • Package: wasmer/edgejs@0.0.0-4ad8137
  • Wasmer: 7.1.0 reproduces
  • Platform: macOS arm64
  • Also reported separately on Linux amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions