cherrypy.lib.static.serve_file + sessions == apparent memory leak
See original GitHub issueOriginally reported by: Eric Atkin (Bitbucket: ericatkin, GitHub: ericatkin)
Hi, I’m running into a problem with serving large files with cherrypy.lib.static.serve_file and sessions turned on that causes cherrypy’s process to quickly use all system memory. I’ve included a sample program that demonstrates the issue below. In my case, test.ogg is a ~200MB file. If I turn off sessions, the problem goes away, but I need sessions in my webapp 😦 I’ve dug in to the cherrypy sources for a while, but got lost. Please help. I’m happy to provide more detail or testing if needed.
Many thanks, Eric Atkin
#!/usr/bin/python
import cherrypy
class Root:
@cherrypy.expose
def default(self, *args, **kwargs):
return '''
<html>
<body>
<audio controls="controls">
<source src="/get" type="audio/ogg" />
Sorry, your browser doesn"t support HTML5 audio tags.
</audio>
</body>
</html>
'''
@cherrypy.expose
def get(self):
return(cherrypy.lib.static.serve_file('/tmp/test.ogg', content_type='audio/ogg', disposition='attachment', name='test.ogg'))
if __name__ == '__main__':
cherrypy.quickstart(Root(), config={
'global': {
'server.socket_host': '0.0.0.0',
},
'/': {
'tools.sessions.on': True,
},
})
Issue Analytics
- State:
- Created 11 years ago
- Comments:6
Top Results From Across the Web
Apparent memory leak running CherrypPy app - Google Groups
I seem to have a memory leak running my CherryPy 3 app under mod_wsgi 1.3. I'm asking here first because the symptoms I'm...
Read more >cherrypy.lib.sessions module
Session implementation for CherryPy. ... This sets the session to be stored in files in the directory /home/site/sessions, and the session timeout to...
Read more >CherryPy Documentation - Read the Docs
By default, CherryPy will save sessions in the process's memory. It supports more persistent backends as well.
Read more >How to debug memory leak in python with cherrypy and pytorch
It seems your model loads every time when inference calls (or during instantiating server). Sometimes model loading is memory and time ...
Read more >close a screen session linux Code Example - Code Grepper
kill all screen sessions linux ... First, find the session you want to quit. 2. screen -ls ... how to check which process...
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
Original comment by Sylvain Hellegouarch (Bitbucket: Lawouach, GitHub: Lawouach):
Though there is still a bug probably, I think this can be workaround by disabling the sessions on the static section:
Hi, I have a similar problem.