mod_python and open HTTP connection

grahamd at dscpl.com.au grahamd at dscpl.com.au
Thu Feb 16 19:08:41 EST 2006


Charles wrote:
> Hello, I'm think about using mod_python for a project but I need to make
> sure: Does mod_python time out after a minute ? (I hope not).

Mod_python itself doesn't time out. If such a thing happened it
would be because of how Apache, some intermediate proxy or
the client is configured.

> If I leave
> an HTTP connection open so that the content keeps loading inside the
> browser window indefinately, and if I close the browser window, the
> mod_python process is terminated, right?

If the mod_python handler is periodically writing data back to the
browser, at the point the socket connection from the client closes,
the attempt to write data back to the client by the mod_python
handler will result in an IOError exception being raised. Presuming
that your handler code doesn't catch this and ignore it, it should
cause the handler to abort.

Note though that it doesn't cause any process to be terminated as
that is not how Apache/mod_python work. It will cause just that
current request to be terminated. That thread of control can then
be reused to handle a subsequent request.

BTW, for tricky questions on mod_python you are better of using
the mod_python mailing list. Details on the mod_python web site.

Graham




More information about the Python-list mailing list