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()spawnsNthreads (--concurrency/-c), each launching its own isolated Playwright browser instance and context. - Target selector resolution: Uses
--target-selectorif provided; otherwise falls back to the firstclickstep in--journey, or the first visiblebutton:visible, input[type='submit']:visibleon the page. - Barrier synchronization: Every lane loads the page, resolves the selector, and waits at a
threading.Barrier(N)before firingpage.click(..., force=True, no_wait_after=True)at the same instant. - Idempotency warning: Tracks
POST/PUT/PATCH/DELETEand>= 400responses 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.
