Two-phase commit of CI job assignment is subject to race condition
Scenario
- Runner A: requests job, gets job 123
- Runner A: writes to Redis: job 123 --runner_manager_A
- Runner B: Requests job, gets job 123 (still in ci_pending_builds!)
- Runner B: Writes to Redis: job 123 → runner_manager_B (OVERWRITES!)
- Runner A: DB transaction: remove from ci_pending_builds
- Runner B: DB transaction: tries to remove (already gone, but no error?)
- Both runners think they own job 123
Context: !206034 (comment 2828746611)
Edited by 🤖 GitLab Bot 🤖