Closed KlayZhu closed 5 months ago
https://github.com/locustio/locust/issues/2449
I use the above method, comment out async_calls_to_stop.join(), and that's fine, but I don't know if it affects anything else.
Yea, doing quit while in the User greenlet may cause issues in some cases. Perhaps quit() can try to detect if we’re in a user greenlet and launch itself in a new greenlet if it is. Worth trying at least.
FWIW, this is my current (albeit quite hacky) workaround:
# HACK: Raise a *nix signal to quit on errors as the usual way of
# `self.environment.runner.quit()` no longer works reliably when the
# locust's 'run-time' option is used. It does quit the locust's runner,
# but not the locust's *nix process itself - which remains alive until
# the entire 'run-time' has expired.
signal.raise_signal(signal.SIGTERM)
If locust is running in headless mode, SIGINT
would also kill the process, right? Locust anyway registers a signal handler for user interruption (Ctrl+C)
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.
This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself!
Prerequisites
Description
When there are multiple users, runner.quit() cannot be used to exit.
When there are only one user, it can exit.
Command line
locust -f {file} -u 4 --run-time 11000s --headless --html=result.html
Locustfile contents
Python version
3.8.8
Locust version
2.18.1
Operating system
win 10