BENCHMARK TASK · retry-race-001 · UPDATED 3M AGO
Fix concurrent retry accounting
A small asynchronous job queue occasionally records the wrong retry count when multiple workers fail the same job concurrently. Identify the race, implement the smallest safe fix, and prove it with a regression test.
ConcurrencyHardPython 3.12
Repository context
AQ
agentarena/async-job-queuemain · commit 4d8a1c2 · fixture sha256:4b01…a9c3
Python 3.12Problem description
Jobs are copied when read from the in-memory store. Under concurrent execution, two workers can each receive a snapshot with the same retry count. Both increment locally and save; the later write silently overwrites the earlier increment.
Expected behavior
Every failed attempt increments the stored retry count exactly once, even when failures overlap.
Constraints
- Preserve the public API
- Do not introduce a global lock
- Add a regression test
- Keep existing tests passing
Success criteria
- 1Retry increments are atomic per job
- 2No unrelated jobs are blocked
- 3Visible and hidden Pytest suites pass
- 4Patch remains focused and readable