https://github.com/ltla/h5wasm-pthreads-mre
A minimum reproducible example of my problem.
https://github.com/ltla/h5wasm-pthreads-mre
Last synced: 5 months ago
JSON representation
A minimum reproducible example of my problem.
- Host: GitHub
- URL: https://github.com/ltla/h5wasm-pthreads-mre
- Owner: LTLA
- Created: 2022-04-26T21:39:58.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-27T05:54:01.000Z (about 4 years ago)
- Last Synced: 2025-06-09T04:04:44.790Z (about 1 year ago)
- Language: CMake
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Minimal example for HDF5 + Pthreads failure
... even though I'm not actually using HDF5 in any parallel regions.
1. Install and activate the latest Emscripten (3.1.9).
2. Run `./build.sh` to build the minimal example.
3. Run `./run.sh` to run through a few hundred iterations of the test code.
Once every hundred iterations or so, this will give sporadic errors like:
```
RuntimeError: Aborted(segmentation fault)
at abort (file:///Users/luna/Programming/js/h5-mre/build/minimal.js:1506:10)
at segfault (file:///Users/luna/Programming/js/h5-mre/build/minimal.js:924:2)
at SAFE_HEAP_LOAD_i32_1_U_1 (:wasm-function[605]:0x10071)
at _emscripten_thread_sync_code (:wasm-function[226]:0x51ea)
at _emscripten_yield (:wasm-function[241]:0x5a52)
at emscripten_futex_wait (:wasm-function[227]:0x52cd)
at __timedwait_cp (:wasm-function[284]:0x7291)
at __timedwait (:wasm-function[285]:0x72f8)
at __pthread_mutex_timedlock (:wasm-function[310]:0x7d74)
at __pthread_mutex_lock (:wasm-function[308]:0x7c62)
```
Observations:
- Failure rate is very low but reproducible; around 1 per 200 runs on my Mac.
- You may need to increase the number of threads in `minimal.cpp` and the linker flags to get the error to trigger at a reasonable rate.
For my Ubuntu machine, I need to bump it up to 8 threads to get the same error rate as the Mac.
- Doesn't fail with 3.1.8 (tested ~1000 runs).