WebAssembly / WebAssembly/binaryen
wasm-opt crashes with segmentation fault on big project
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
Hello!
We found that wasm-opt sometimes crashes with the error `Segmentation fault (core dumped)'.
What can help with debugging:
- We use wasm-opt together with tinygo.
- The error appears on a large project, if we remove any parts from this project in order to reduce the project, the error disappears. We couldn't make a minimal example to reproduce, and our project is proprietary and I can't give it.
- The error is not reproducible on mac, valid working configuration:
% tinygo version
tinygo version 0.37.0 darwin/amd64 (using go version go1.22.12 and LLVM version 19.1.2)
% /usr/local/bin/wasm-opt --version
wasm-opt version 117
- The error is consistently reproduced on linux on different hardware, with different operating systems, different versions of wasm-opt (tested 116 and 123).
- The error is reproduced only on your builds (https://github.com/WebAssembly/binaryen/releases). When I downloaded the project and built it myself, the error did not reproduce.
Own build, does not fall:
$ rm /tmp/tinygo3733807473/main.wasmopt
$ ls /tmp/tinygo3733807473/
main main.o
$ ./build/bin/wasm-opt --version
wasm-opt version 123 (version_123)
$ ./build/bin/wasm-opt -O2 -g /tmp/tinygo3733807473/main --output /tmp/tinygo3733807473/main.wasmopt
$ ls /tmp/tinygo3733807473/
main main.o main.wasmopt
Downloaded build of the same version crashes:
$ rm /tmp/tinygo3733807473/main.wasmopt
$ ls /tmp/tinygo3733807473/
main main.o
$ /opt/binaryen-version_123/bin/wasm-opt --version
wasm-opt version 123 (version_123)
$ /opt/binaryen-version_123/bin/wasm-opt -O2 -g /tmp/tinygo3733807473/main --output /tmp/tinygo3733807473/main.wasmopt
Segmentation fault (core dumped)
Thank you. Write to issue thread if you need more information.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report names only the wasm-opt command, TinyGo 0.37.0, and the differing release and self-built Binaryen binaries; start by reproducing the Linux command and comparing those build environments. The proprietary input is unavailable and no source files or tests are named, so completion depends on obtaining a shareable reduced case and preventing the release build from segfaulting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100