LOKI LogoLOKIv1.10.0

Concurrency & Race Probes

Open N synchronized browser lanes and fire the same action simultaneously to expose race conditions.

Usage

bash
loki run http://localhost:8000 --concurrency 5 --target-selector "#pay-button"
# Or use -c with a recorded journey (targets the journey's first click step by default):
loki run http://localhost:8000 --journey checkout_flow -c 3

How it works

  • Independent browser lanes: ChaosSandbox.run_concurrent_probe() spawns N threads (--concurrency / -c), each launching its own isolated Playwright browser instance and context.
  • Target selector resolution: Uses --target-selector if provided; otherwise falls back to the first click step in --journey, or the first visible button:visible, input[type='submit']:visible on the page.
  • Barrier synchronization: Every lane loads the page, resolves the selector, and waits at a threading.Barrier(N) before firing page.click(..., force=True, no_wait_after=True) at the same instant.
  • Idempotency warning: Tracks POST/PUT/PATCH/DELETE and >= 400 responses per lane; if multiple lanes succeed (< 400), LOKI flags potential missing server-side idempotency locks.

Race probes can create duplicate records or double charges. Use a disposable test database.