Auto scale docker machine runner creates more machine than the limit configured
Summary
When IdleCount
is set to 0 (https://docs.gitlab.com/runner/configuration/autoscale.html#additional-configuration-information), a runner may create more machines than the limit
parameter allows.
In https://gitlab.com/gitlab-org/gitlab-runner/-/blob/ab4b1f2e8c08c4aad183775eacfbf9c797fddfa9/executors/docker/machine/provider.go#L491-497, if IdleCount == 0
and no machine is identified due to hitting the limit in maxMachines
, Acquire
returns no error, and the job will create a runner machine later, ignoring maxMachines
. acquireBuild
in https://gitlab.com/gitlab-org/gitlab-runner/-/blob/ab4b1f2e8c08c4aad183775eacfbf9c797fddfa9/commands/builds_helper.go#L105 attempts to check that the number of builds for that runner doesn't exceed limit
, but that's different from the number of machines.