A small CLI tool for reproducing heisenbugs
Project description
Heisenrun
Heisenrun is a small CLI tool for reproducing heisenbugs by running many instances of a command in parallel.
Heisenbugs are bugs that appear only under certain timing or concurrency conditions and disappear when you try to debug them. Heisenrun increases the chance of triggering such bugs by repeatedly executing a command concurrently.
Typical use cases:
- Reproducing flaky tests
- Triggering race conditions
- Stress-testing CLI programs
- Detecting nondeterministic behavior
Getting Started
Run instantly (recommended)
Using uv:
uv tool run heisenrun --help
Example:
uv tool run heisenrun -n 10 -m 2 -- sleep {#}
This downloads and installs heisenrun into an isolated environment. If you wish more control please consider the next command.
Install tool via UV (also recommended)
You can explicitly also heisenrun with uv:
uv tool install heisenrun
Then run:
heisenrun --help
The uv tool install command gives you more control. You can specify the tool's version, manually upgrade it, remove it, and etc.
Install with pipx
pipx also installs CLI tools in isolated environments:
pipx install heisenrun
Then run:
heisenrun --help
Install with pip (not recommended)
Global installation via pip works but is generally discouraged for CLI tools:
pip install heisenrun
Examples
Run a command 10 times
All 10 processes are created instantly. They run in parallel.
heisenrun -n 10 -- sleep 1
Use run index {#}
Use {#} in command to insert the index of the current run:
heisenrun -n 10 -- sleep {#}
Example expansion:
sleep 0
sleep 1
sleep 2
...
sleep 9
Limit parallelism
The -m option allows you to specify the maximum number of commands running in parallel.
This will take about 5 seconds.
heisenrun -n 10 -m 2 -- sleep 1
Set timeouts
Abort runs that take too long:
heisenrun -n 10 -t 5s -- sleep {#}
Example report:
Execution Report
┏━━━━━━━━━━┳━━━━━━━━━┓
┃ Instance ┃ Status ┃
┡━━━━━━━━━━╇━━━━━━━━━┩
│ 0 │ SUCCESS │
│ 1 │ SUCCESS │
│ 2 │ SUCCESS │
│ 3 │ SUCCESS │
│ 4 │ SUCCESS │
│ 5 │ SUCCESS │
│ 6 │ TIMEOUT │
│ 7 │ TIMEOUT │
│ 8 │ TIMEOUT │
│ 9 │ TIMEOUT │
└──────────┴─────────┘
Capture outputs
Store outputs (stdout and stderr) of each run in a directory:
heisenrun -n 50 -o outputs -- ./program
Example directory structure:
outputs/
0_output.txt
1_output.txt
...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file heisenrun-0.1.0.tar.gz.
File metadata
- Download URL: heisenrun-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85ff8c4f51330131c43b28359bf1b8a6296db6132127f3514c49355db73cdb0a
|
|
| MD5 |
6c3446abae8bb6e247a3c06ffae0bb6f
|
|
| BLAKE2b-256 |
5954e82f923f9aafd2f1a08da9522b5684c83f9630e4d2b0377ae882d6c88f32
|
File details
Details for the file heisenrun-0.1.0-py3-none-any.whl.
File metadata
- Download URL: heisenrun-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9e2b61414a04f0ce7761ede704d247915f5b0f8a899f9e5f874751b28564f94
|
|
| MD5 |
88bafa67efd145f4b71859e654d26b7d
|
|
| BLAKE2b-256 |
de83067490e8e8382fbf415514c58f9c3d10212ef0c96040bcd124de6f70dfdb
|