Summary
Concurrent calls can race executeRequest and spawn more than maxProcesses workers.
Failure mode
- Multiple requests see
processPool.length < maxProcesses and spawn concurrently, overshooting the cap.
- Pool size grows beyond intended limits; resource usage spikes.
Repro (adversarial)
- Configure
maxProcesses=2 and fire many concurrent requests at startup.
- Observe pool size exceeding 2.
Acceptance criteria
- Worker spawning is synchronized to respect
maxProcesses under concurrency.
- Adversarial test asserts pool size never exceeds cap.