Closed alien11689 closed 4 years ago
Can you show me the code?
I cannot show you the whole code, but to test it is enough to create locust worker like this:
public class HttpGetTask extends AbstractTask {
@Override
public void execute() throws Exception {
Thread.sleep(1000);
Locust.getInstance().recordSuccess("test", "with sleep", 1000, 0);
}
}
and run master with step load:
locust --locustfile dummy.py \
--master \
--headless \
--expect-workers 1 \
--users 1000 \
--hatch-rate 100 \
--run-time 120s \
--step-load \
--step-users 100
--step-time 10s
success rate should be linear, but because of InterruptedException
old threads won't be stopped and at the end worker will report success from 5500 threads instead of 1000
Thanks @alien11689 , it's a bug when working with --step-load. The master repeatly send hatch message instead of stopping previous tasks.
Fixed in version 1.0.11
When I set step load parameters on master (e.g. step users 100 and duration 60s), than master sends new hatch messsage with 60s interval, but old threads are not stopped.
It's because Abstract task executor swallows InterruptedException which is thrown by my task in
Thread.sleep
:and task thread cannot be stopped
To fix it I have to throw
Error
instead ofInterruptedException
what stops the task, but looks ugly.