Memory leak serving static files
See original GitHub issueDescribe the bug The memory of the process is increasing for everytime I request a static file.
Code snippet
import os
app = Sanic(__name__)
here = os.path.dirname(__file__)
app.static("/static", os.path.join(here, "static")
if __name__ == "__main__":
app.run()
Access a static file. The bigger the file the more memory will be tied up. http://localhost:8000/static/index.html
Expected behavior Memory should be cleared up after serving a static file or at least not linearly increase with each request.
Environment (please complete the following information):
- OS: macOS BigSur 11.5.2
- Version 21.9.1
Update: I have been trying to replicate our setup as close as possible and can now quite reliably reproduce the issue. Could you have a look here and let me know if this works for you? https://github.com/seibushin/sanic-mem-leak
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (11 by maintainers)
Top Results From Across the Web
Node.js - Memory leak when static file connection is dropped ...
I solved the issue by using nginx to serve static files! Might just be a temporary solution, but it works.
Read more >memory leak when serving static files · Issue #231 - GitHub
We are not releasing the request buffer when transmitting a static file.
Read more >[Solved]-Node.js - Memory leak when static file connection is ...
I solved the issue by using nginx to serve static files! Might just be a temporary solution, but it works. Dennis J 176....
Read more >Lighttpd's memory leaks, a myth or true? If true, does it apply ...
Do Lighttpd's memory leak issues apply when it's serving static content as well? (Most of those complaining are employing Lighttpd to serve ......
Read more >PK22485: IHS MEMORY LEAK IF FILES BEING SERVED ARE ...
Do not modify static files while the webserver processes is running. Problem summary. A file was truncated while mod_include was reading the file....
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
Initial memory usage:
After holding down command + shift + R for maybe 1 or 2 seconds
I have created a repo to reproduce the issue. Could you have a look here? https://github.com/seibushin/sanic-mem-leak
Let me know if that works for you and sorry for the late reply.