Gunicorn Workers Hang And Memory Does Not Get Deallocated
See original GitHub issueHey,
I’m currently running a load test. I’m serving my Starlette app with gunicorn, with this line of code ;
gunicorn -w 48 -k uvicorn.workers.UvicornH11Worker -b 0.0.0.0:5000 app:app --timeout 10 --threads 2
So there is nothing wrong with the performance but the thing is memory consumption gets increased continuously. Even after the test is finished and app is not receiving any more requests, memory does not get deallocated. There was no request that app could not return a response not even an error. Could this be related to uvicorn workers?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Gunicorn worker doesn't deflate memory after request
I have a single gunicorn worker process running to read an enormous excel file which takes up to 5 minutes and uses 4GB...
Read more >Does Gunicorn Thread Take More Ram Memory - ADocLib
Gunicorn Workers Hang And Memory Does Not Get Deallocated #667 There was no request that app could not return a response not even...
Read more >Changelog — Python 3.11.1 documentation
gh-99729: Fix an issue that could cause frames to be visible to Python code as they are being torn down, possibly leading to...
Read more >Chasing Memory Leak In a Python Web Service - Story Of ...
The workers are Sanic Gunicorn workers that expose a GET only REST interface to the clients. couchbase library is used which internally uses...
Read more >Gunicorn worker configuration for memory | by Satendra Pratap
We need to understand sport's nitty gritty well then improve upon or ... As you can see, each nginx worker is not taking...
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
Generally when I’ve seen any issue along these lines come up, the end result tends to come out as “this is just the Python runtime pre-emptively hanging onto memory that’s been allocated, rather than returning it to the O/S” rather than a memory leak. Eg. https://stackoverflow.com/questions/15455048/releasing-memory-in-python.
That may or may not be the case here, but it’s worth keeping in mind.
Having said that, your comment of “This continues until I run out of memory or restart the process.” does sound suspect.
The way to approach this would be:
Fortunately, I also encountered a similar problem, I don’t understand it, how did you solve it?