Skip to content

Add stress test harness for concurrency bugs#38

Merged
knifecake merged 6 commits intomainfrom
stress-test
Feb 20, 2026
Merged

Add stress test harness for concurrency bugs#38
knifecake merged 6 commits intomainfrom
stress-test

Conversation

@knifecake
Copy link
Owner

@knifecake knifecake commented Feb 20, 2026

Summary

  • Adds a standalone stress test script (tests/stress_test.py) that spins up the full supervisor with configurable workers/threads/queues, enqueues thousands of tasks, and verifies correctness invariants (no lost jobs, no duplicates, no stuck executions).
  • Adds a stress_counter_task to the dummy test app with configurable workload profiles (--workload none|light|medium|heavy) mixing IO-bound (sleep) and CPU-bound (SHA-256 iterations) work.
  • Quiets the django.tasks logger in test settings to reduce noise during stress runs.

This is the kind of test that surfaces race conditions like #25 (duplicate ClaimedExecution) and #26 (process is None on execution).

Usage

# Default: 1000 tasks, 3 workers, 4 threads, 3 queues
uv run python tests/stress_test.py

# Full stress: 10k tasks with simulated work
uv run python tests/stress_test.py --tasks 10000 --workers 3 --threads 4 --workload medium

# Quick smoke test
uv run python tests/stress_test.py --tasks 100 --timeout 60 --workload light

Test plan

🤖 Generated with Claude Code

knifecake and others added 6 commits February 20, 2026 07:50
Adds a standalone stress test script that enqueues a configurable number
of tasks across multiple queues and processes them through the full
supervisor with multiple workers and threads. Verifies invariants like
no lost jobs, no duplicate executions, and no stuck executions — the
kind of issues reported in #25 and #26.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Runs the stress test with 10 tasks as a separate job in parallel with
the test matrix, just to verify the harness doesn't break.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The cleanup step deletes from steady_queue tables which don't exist yet
on a fresh CI database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The steady_queue tables live on the queue database, not the default one.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@knifecake knifecake merged commit 08a5a2b into main Feb 20, 2026
3 checks passed
@knifecake knifecake deleted the stress-test branch February 20, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant