Skip to main content

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

heisenrun-0.0.6.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

heisenrun-0.0.6-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file heisenrun-0.0.6.tar.gz.

File metadata

  • Download URL: heisenrun-0.0.6.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

Hashes for heisenrun-0.0.6.tar.gz
Algorithm Hash digest
SHA256 3b2adad6d7a451341aa9a67e235c4eb01f69331c0b6153477da5c7f0d55f28cd
MD5 f195e36690531f22c517ad4b0bc35e37
BLAKE2b-256 89fedac76b85c550767d4d0e6f5a6d6408332c047866d299cb55cb11ad8409f0

See more details on using hashes here.

File details

Details for the file heisenrun-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: heisenrun-0.0.6-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

Hashes for heisenrun-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cde1dc2fcad471cb3619f8f2ab50031b18d77c5ca33ae39fdbbbc3f24a7f4110
MD5 71ee19f247d6813091ed6e6b48ba58d0
BLAKE2b-256 ecf1f5c8dec5e8a2d1696321f9cc09cb069bab00b07cd7f4fca60d47d406f562

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page