[mod_python] How can I easily terminate a apache task?

Leonid Timochouk L.A.Timochouk at ukc.ac.uk
Fri Sep 1 12:55:06 EST 2000


Hello Daniel,

The easiest thing to try would be to invoke sys.exit (...) from your
Python script -- my understanding is that the Python interpreter runs in
the same process as the Apache task which created it. This is certainly
true for a normal "handler"; I never tried a "cgi handler" but believe
that the mechanism should be the same.

If this does not work for any reason, try os._exit (...) instead. However,
there may be a problem if your Apache task is actually a thread rather
than an independent process (which OS are you using?) -- in that case you
may try thread.exit ().

These solutions (if any of them works) are not Apache-specific, and quite
"rude" in the sense that they terminate the Apache task without any
internal clean-up. So maybe someone else knows a better way?

Sincerely,
L.A. Timochouk




More information about the Mod_python mailing list