--limit-max-requests not working
See original GitHub issueHi! I’m trying to figure out why my workers are not restarting as expected when using the --limit-max-requests
flag. I ran uvicorn
in debug mode and noticed that the self.server_state.total_requests
count is not increasing (stays at 0 after each request) so self.server_state.total_requests >= self.config.limit_max_requests
never returns True
.
When looking into where the total_requests
was used, I noticed that the protocols.http.[auto/h11/httptools]
were never getting called. I tried forcing the --http h11
and --http httptools
parameters, without any change in behavior. Any help would be appreciated!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Developers - --limit-max-requests not working - - Bountysource
Hi! I'm trying to figure out why my workers are not restarting as expected when using the --limit-max-requests flag.
Read more >Maximum request length exceeded. - asp.net - Stack Overflow
Save this question. Show activity on this post. I am getting the error Maximum request length exceeded when I am trying to upload...
Read more >Preventing server overload: limit requests being processed ...
The solution is to limit the maximum number of concurrent requests, so some fraction of requests fail, but the others are processed.
Read more >Side effects of setting max-requests on uwsgi config
As far as i know, the only downside of setting max-requests is that when running apps that load on the first request to...
Read more >Limits and Quotas on API Requests | Analytics Core Reporting ...
If your request to the Reporting API fails with a server error, you get a response code 500 or 503 . You can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To reproduce
Content of aiohttp_main.py:
Content of fastapi_main.py
Here is the output from each experiment showing that with the aiohttp.GunicornWebWorker, the worker is getting properly restarted, but not with the uvicorn.workers.UvicornWorker (generated the load with:
for i in $(seq 1 20); do curl http://0.0.0.0:8000; done
):Output:
Output:
--limit-max-requests
only terminates the worker process. The manager process will not restart it again. You can use uvicorn with gunicorn.Ref: https://www.uvicorn.org/deployment/