cli: wasm-opt SIGABRT is swallowed — `dx build --release` exits 0 and ships the unoptimized wasm
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:
[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:
- A failed
wasm-opton a--releasebuild 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. wasm-optnot 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)
Minimal reproduction, and a sharper root cause than my original report suggested.
Minimal repro — crashes on the default profile too
The custom [profile.wasm-release] in my report turns out to be a red herring. An 11-line hello-world with no profile customization at all reproduces the crash:
Cargo.toml:
[package]
name = "repro"
version = "0.1.0"
edition = "2024"
[dependencies]
dioxus = { version = "0.7", features = ["web"] }
src/main.rs:
use dioxus::prelude::*;
fn main() {
dioxus::launch(app);
}
fn app() -> Element {
rsx! {
div { "hello" }
}
}
Dioxus.toml:
[application]
name = "repro"
[web.app]
title = "repro"
dx build --release (dioxus-cli 0.7.9, rustc 1.97, rust:1.97-slim-trixie Docker image, linux/arm64):
11.49s ERROR wasm-opt failed with status code signal: 6 (SIGABRT)
stdout: compile unit size was incorrect (this may be an unsupported version of DWARF)
11.49s INFO Copying asset (1/2): /repro/target/dx/repro/release/web/public/wasm/repro_bg.wasm
11.50s INFO Client build completed successfully! 🚀
Exit code 0, and the shipped repro_bg-*.wasm is 1.8 MB (the pre-wasm-opt artifact).
Root cause (per wasm-opt's own stdout)
compile unit size was incorrect (this may be an unsupported version of DWARF) — binaryen version_129 aborts while parsing the DWARF that ends up in the module (rustup's precompiled std for wasm32-unknown-unknown carries debug info, and dx forces strip=false via --config). Since dx passes --debuginfo to wasm-opt whenever --debug-symbols is at its default true, the DWARF parser is always engaged — and crashes.
This also explains why my original workspace only crashed with the custom profile: with our [profile.release] (lto = "thin", codegen-units = 1, dx-injected opt-level = "s") the surviving DWARF happens to be in a shape binaryen tolerates; opt-level = "z", lto = "fat", or the stock default profile (no LTO, 16 CGUs) produce DWARF it aborts on.
Workaround
dx build --release --debug-symbols false — dx then passes --strip-debug instead of --debuginfo, the DWARF parser is never engaged, and the same repro builds cleanly: 0 errors, optimized 463 107 B wasm (vs 1.8 MB unoptimized when the crash is swallowed).
The actionable dx-side bug stands regardless of the binaryen half: a crashed wasm-opt on a --release build should fail the build (or at least fail loudly in the final summary), not ship the unoptimized binary with exit 0.