DioxusLabs / DioxusLabs/dioxus
cli: wasm-opt SIGABRT is swallowed — `dx build --release` exits 0 and ships the unoptimized wasm
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## Problem
When `wasm-opt` crashes during a release web build, `dx` logs an `ERROR` line but **continues the build, produces a bundle with the unoptimized `.wasm`, and exits 0**. CI and scripts see a successful build; the only observable symptom is a silently larger binary (in our case +15–23%).
Separately (or as the trigger): with a user-defined `[profile.wasm-release]` in the workspace `Cargo.toml`, `wasm-opt` (binaryen version_129, auto-downloaded by dx) reliably crashes with SIGABRT on the resulting module.
## Reproduction
dioxus-cli 0.7.9, `dioxus = { version = "0.7", features = ["web"] }`, Rust 1.97 (edition 2024), building inside `rust:1.97-slim-trixie` Docker (linux/arm64, Apple Silicon host).
Workspace root `Cargo.toml`:
```toml
[profile.release]
lto = "thin"
codegen-units = 1
strip = true
# defining this profile makes dx skip its own ad-hoc profile injection
[profile.wasm-release]
inherits = "release"
opt-level = "z" # also crashes with: opt-level = "s", lto = "fat"
strip = false
```
`dx build --release` output:
```
INFO Installing wasm-opt
INFO wasm-opt installed from Github
ERROR wasm-opt failed with status code signal: 6 (SIGABRT)
```
…and then the build **succeeds** (exit 0). The shipped `.wasm` is the pre-wasm-opt artifact:
| build | shipped .wasm |
|---|---|
| default profile (dx injects `opt-level="s"`), wasm-opt OK | 2 096 398 B |
| `[profile.wasm-release] opt-level="z"`, wasm-opt SIGABRT | 2 405 298 B |
| `[profile.wasm-release] opt-level="s", lto="fat"`, wasm-opt SIGABRT | 2 582 008 B |
Reproduced 3/3 times for each failing variant (clean Docker layer, no cross-build cache). The identical asset hash across retries confirms determinism. The same workspace builds fine and wasm-opt succeeds when the custom profile is removed.
## Expected
Either of:
1. A failed `wasm-opt` on a `--release` build fails the build (or at minimum a prominent warning in the final summary), instead of silently shipping an unoptimized binary. A size-budget CI gate is currently the only thing that catches this.
2. `wasm-opt` not crashing on custom-profile output — happy to file the binaryen half upstream if useful, but dx swallowing the crash is the actionable part here.
## Environment
- dioxus / dioxus-cli 0.7.9 (prebuilt in Docker via `cargo install dioxus-cli --version 0.7.9 --locked`)
- binaryen: version_129 (auto-installed by dx "from Github")
- rustc 1.97 (edition 2024), `wasm32-unknown-unknown`
- Docker `rust:1.97-slim-trixie`, linux/arm64 (OrbStack, Apple Silicon)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the dx build release path that invokes wasm-opt and inspect how its SIGABRT status is handled. Reproduce with the custom [profile.wasm-release] in Cargo.toml, then verify that a failed wasm-opt causes dx build --release to report failure instead of shipping the unoptimized .wasm.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100