BUG/MINOR: haload: -ee could burst past its floor when many users fail at once
On a large, near-simultaneous outage (e.g. -u 10000 on several
threads), -ee's 1 req/s floor could be blown past. A burst of several
thousand requests could fire right when the ramp starts. This defeats
the whole point of probing gently.
Two separate gaps caused this:
- hld_rate_task() creates replacement users after a kill. It only
counted a new user once it later connected, not when it was
created. Many kills in a row wake this task up again and again,
before any replacement has had time to run. Each time, it still
saw an empty counter, and created one more than it should. It now
counts a new user right when it decides to create it.
- hld_rate_task() has a "no rate limit, fill directly" path. It is
used to refill users after a kill when -R is not set. It only
checked arg_rate. On a mass failure, another thread can already be
inside hld_err_trigger(), with its new arg_rate not visible here
yet. This path would then still fire, and fill the whole thread's
quota at once. It now also checks err_ramp_pending. This flag is
set first by hld_err_trigger(). Seeing it at 0 means no trigger is
running.