-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delay at startup and high cpu usage on Windows in Python 3.12 #2555
Comments
Can you reproduce this with a locustfile that doesnt use any of your dependencies? If possible, can you downgrade locust and find the latest version that doesnt have this issue? |
Also, what if you use tasks directly on the User instead of using a separate TaskSet? |
Just tested it with only locust imported and I was able to reproduce it. 😕 Could it maybe be a updated Python version or Windows Update? Edit:
This also didn't help |
Hmm… very strange. Can you try running just a plain locustfile with none of your ”special” stuff? And maybe try changing the weight from 300 to 1? |
Same results. I used the basic example from the docs and changed the url: from locust import HttpUser, task
class HelloWorldUser(HttpUser):
@task
def hello_world(self):
self.client.get("/api/v1/health")
|
By the way, the same happens when I run it headless:
|
Wow. That is really weird. I’ll have to try it on my windows machine some time. I dont expect I’ll be able to reproduce it though :-/ |
Thanks in advance. Your project is awesome. 👍 |
Sorry for not getting back to you sooner. I tried the simplified script on my machine with no issues.
|
I also tried with the web-ui. It is very noisy when I use ctrl-c to exit, but other than that I had no issues (with the simplified test). |
After continue working with locust I noticed that this issue seems to occur only with targets over https. |
Is your server maybe not responding? https works fine for me as well. |
wait, now I WAS able to reproduce with https. Probably some exception is being triggered and then there is an infinite loop. I will investigate. |
For now, you can try using FastHttpUser as a workaround. |
The |
Huh. there seems to be a regression in OpenSSL OpenSSL 3.0.13/Python 3.12 I was able to reproduce with 3.12 but not with 3.10. |
Interesting. I hope there will be a fix anytime soon. |
I'm looking into it. Might be possible to just set insecure option somewhere. |
A really awkward workaround is letting your users share a connection pool. That seems to avoid the issue....
|
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. |
Any news on this one other than the workaround? |
There’s an open PR for requests that could fix it for HttpUser: (maybe something similar could be implemented for geventhttpclient as well) Either way, this cant really be fixed in locust as it is an underlying issue. |
If you encounter this issue, then install the latest and greatest |
* remove generated front end bundle * add poetry and front end dist to vcs ignore * update build system manifest for poetry - Modify pyproject.toml file for poetry build system - Adds build script to generate front end as part of poetry build - Adds renaming script to remove architecture info from wheel file name - Updates Makefile to call the correct build steps with `make build` * chmod on release renaming script * re-add wheel extension to changed file name * ensure vsc autoversioning plugin * ensure vcs auto versioning plugin * revert vscode settings * add local dev install command * add version file to package output * only include poetry lock in sdist * run build setup as one shell * check if yarn is installed before building * deny poetry venvs creation * remove poetry installation and just check for poetry and yarn * update URLs for related info * Ensure spawning_complete happens only once on workers. * Update various test cases for new spawning_complete behavior. * Simplify additional test cases using the new get_messages function. * Set worker_state to 'running' in start_worker (this used to be by spawning_complete before #2728, but now that only happens once *all* workers have finished) * Simplify semaphore_wait example * Reverse accidental change * Update WorkerRunner.state when spawn cycle is done (it used to rely on the event happening) * Further simplify example * Rewrite confusing error messages if someone accesses an HTTP Web UI using https * Convert report time to locale time * Update HTML report tests * Use requests 2.32.2 or higher for Python 3.12, fixes #2555 * Upgrade Sphinx to latest version * Add to extensions also? Mentioned in https://sphinx-rtd-theme.readthedocs.io/en/stable/installing.html#how-to-install-and-use-the-theme * hash anchors in setup docs pages * testing version of pep440 generator * remove dist * ignore dist contents * include changes to pyproject from main - requests version * Remove unnecessary python https://sphinx-rtd-theme.readthedocs.io/en/stable/installing.html * Downgrade docutils to officially supported * Restore theme name * Fix ruff error * Rename css options * Conform to style * Add timestamp to chart tooltip * Add zoom to echarts * Update test * Fix empty timestamp formatting * Round total_avg_response_time from history * Reduce CSV_STATS_FLUSH_INTERVAL_SEC to 5 seconds by default (more reasonable in the time of SSD:s :) and remove it from the docs (because it will only rarely need to be adjusted, and increasing it is a very unusual need) * Dial back the API TOC * doc formatting fix * Modify timestamp generation to remove deprecation warning * Add newline at the end of the file * Fix incorrect error message detection for https requests introduced in 84ada19 * update build system manifest for poetry - Modify pyproject.toml file for poetry build system - Adds build script to generate front end as part of poetry build - Adds renaming script to remove architecture info from wheel file name - Updates Makefile to call the correct build steps with `make build` * remove merge object * test commit distance * jinja templating for format number * simple vesion formatting * take a stab at updating workflows for poetry * might as well add discussions forum while I'm here * add docs serve command to makefile * developing locust docs page * make readme and pyproject align in terms of URLs * remove unused py version in wheel * adjust dockerfile for poetry build * add dev dependency group * docs dependencies * docs dependencies and readme * venv for tests * RTD config for versioning * rtd step * don't run the build script on the remote * rtd * tests and tox * tox fixes * progress on CI runners locally * skip front end build * in-progress * run on remotes not my poor laptop * run on remotes not my poor laptop * ruff and mypy version * yarn timeout for windows, update mypy * windows plz * windows plz * add mypy as a dev dependency * tests * testing if this is actually a shell thing * increase fetch depth for dunamai versioning * I know what the problem is at least * test windows * tox install * revert vs code settings * remove oneshell directive from old installation process * Update maintainers and authors * move web ui to correct location * update file exclusions * skip fe build in fail-fast test * pin some version dependencies * update tox version * add wheel renaming to prepublishing steps --------- Co-authored-by: Lars Holmberg <[email protected]> Co-authored-by: Andrew Baldwin <[email protected]> Co-authored-by: Sam Wright <[email protected]> Co-authored-by: Lars Holmberg <[email protected]> Co-authored-by: JavierUhagón <[email protected]>
Fixed properly in the above PR, released in 2.32.5. |
Prerequisites
Description
When I start a test with let's say 50 peak users and a spawn rate of 10, locust won't run any requests for 5 seconds and the starts them all at once.
Same happens when I increase or decrease the peak number while a test is running: The test stops completely
Weird is also, that it complains about high CPU usage, which is not the case at all (CPU is a Ryzen 7 7800X3D).
This issue only happens since I updated locust to the latest version a while ago. Before that the user ramp-up/-down ran butter smooth.
I use locust via the Web UI.
This is what it looks like in the UI with the weird startup and rampup (negative spike at the end of the graph)
Command line
locust -f .\tests\load_test.py
Locustfile contents
Python version
3.12
Locust version
2.20.1
Operating system
Windows 11
The text was updated successfully, but these errors were encountered: