Re: Small improvement to RegisteringCleanupCode

15 views
Skip to first unread message

Graham Dumpleton

unread,
Dec 17, 2012, 8:32:46 PM12/17/12
to Bas van Oostveen, modwsgi



On 18 December 2012 02:39, Bas van Oostveen <v.oos...@gmail.com> wrote:

Dear Graham,

Could we add your following command to the http://code.google.com/p/modwsgi/wiki/RegisteringCleanupCode page ?

Do realise though that such action still take place in context of lifetime of open connection. So, although you could trigger a cleanup action in this way, for it not to still see connection being held open, you would need to use some mechanism to background the task. For example, have a manager thread which processes jobs placed in an internal task queue. 


I am aware of this issue and yes you do need to be careful of performing actions in close() which take a long time. It is especially not a good idea if you know a browser is using keep alive connections.

Keep alive connections can be a pain for various reasons. My recommendation is often to use nginx as front end and have keep alive turned off in Apache as it solves a lot of issues and for this case at least means that you don't delay a second request coming down same connection from browser client as nginx will use a separate connection for it. It doesn't solve the issue though that long running task in close() will prevent the request thread being released to handle new requests.

Response cc'd to mod_wsgi mailing list as is of general interest. 

Graham

Reply all
Reply to author
Forward
0 new messages