pypi / locust
locust
What changed in locust 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-31.
6 breaking1 security4 new APIs and options27 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initlocust 238 changes
Breaking changes 6
Malformed HTTP responses are now reported as failed requests.
A non-finite spawn_rate is rejected instead of reporting a successful start.
The /stats/reset endpoint now accepts POST requests only, closing a CSRF vector; callers using the web UI as an API must adjust their requests.
The /stop endpoint now accepts POST requests only, closing a CSRF vector; callers using the web UI as an API must adjust their requests.
constant_throughput() rejects a non-positive rate.
new_dispatch() rejects a non-positive spawn_rate.
Security 1
The endpoint rejects a negative user_count.
New APIs and options 4
FastHttpSession adds rename_request.
FastHttpSession adds request_name.
Adds a rest method to HttpUser.
Adds Poisson-distributed task arrivals for configuring wait times.
Fixes and other changes 27
The output directory is created when writing CSV output.
The stats history CSV writer no longer crashes on workers using --csv-full-history.
The worker's message loop stays alive when a custom message listener raises an exception.
locust_exception_handler no longer crashes when Environment.parsed_options is None.
Removing a listener while an event fires no longer causes the next listener to be skipped.
FastHttpUser percent-encodes the request target.
The HTML report file name now preserves a fractional spawn rate.
The output directory is created when writing the HTML report.
The output directory is created when writing JSON output.
A shape class imported from another locustfile is no longer reported as a duplicate.
The output directory is created when writing the log file.
MongoDBClient now queries the correct database and runs the query.
Request names already seen are retained when the name cap is reached.
OTEL and CSV request listeners now accept response_time=None.
Users that are already stopping are no longer asked to stop again.
An exception raised in User.on_start now fires user_error.
Constant pacing is corrected after wall-clock adjustments.
allow_redirects=False works with geventhttpclient 2.5 and later.
Timestamp differences are calculated before truncation, avoiding truncated durations.
The caller-provided headers dict is no longer modified.
Percent-encoded credentials in the host URL are decoded, and IPv6 brackets are retained in base_url.
The web UI user count now persists in parsed_options.
The endpoint rejects a negative spawn_rate instead of reporting a successful start.
Negative --users no longer causes an infinite hang in headless mode.
The median is computed using the same rank as the 50% percentile.
Improves the error message shown when Web UI assets are missing.
An unknown worker's spawning_complete no longer kills client_listener.