Add a feature to abort a request if it doesn't complete within a certain period.
This is hard to do. The first problem is that the process can be multithreaded
and so one can't just
kill the process. The second problem is that Python doesn't allow you to kill
threads.
The only way to achieve this is for a separate monitor thread to monitor how
long requests are
taking and if a request takes longer than the timeout, to inject a Python
exception into the context
of the thread for the request handler which is taking to long.
Although one can do this, it doesn't interrupt the thread. If that thread is
blocked in C code it will
remain blocked and the exception will only be noted once it returns back into
Python code.
Further, because it is a Python exception, even though one might use the
SystemExit exception, an
application still technically can catch it and possibly ignore it. So, it may
be necessary for that
monitor thread to keep injecting the signal into the thread on a regular basis
until the request code
finally allows it to propagate up to top most caller. If it doesn't allow this
after certain time, then
process might be killed off, although can only do this if using daemon mode.
Original issue reported on code.google.com by Graham.Dumpleton@gmail.com on 4 Mar 2010 at 11:14
Original issue reported on code.google.com by
Graham.Dumpleton@gmail.com
on 4 Mar 2010 at 11:14