Hi all !
I tried running Quixote on a low-end machine (486/100, 40MB, OpenBSD 3.0)
which basically forks fine, except for these two issues:
1) /dev/urandom seems awfully slow (like 4 seconds to get 8 random bytes).
This is not a Quixote problem, but perhaps randlong() might become
a method of the SessionManager class so it's easier/cleaner to override.
2) No signal handling in fcgi.py. The problem - on OpenBSD (Linux/Solaris
don't show this behaviour) - seems to be this: If FastCGI terminates a
process (by SIGTERM) it might interrupt a call to accept(). If this
happens and the signal is not being handled by the process, subsequent
accept()s on the same socket (by a new process) will block forever. The
signal handler does not even have to do anything, it just needs to be
there...
I have pasted a minimal patch below. This is yet incomplete, it works fine
but the terminated app generates an exception (stderr of FCGI instance
not initialized). Should sys.exit() work from inside a signal handler?
That didn's work when I tried it...
- Robin
--- orig/fcgi.py Wed May 29 02:36:51 2002
+++ fcgi.py Thu Jul 11 11:44:48 2002
@@ -37,6 +37,15 @@
from cStringIO import StringIO
import cgi
+
+
+def _term_handler(signum, frame):
+ pass
+
+import signal
+signal.signal(signal.SIGTERM, _term_handler)
+
+
Exception:
Traceback (most recent call last):
File "/var/www/cgi-bin/qtest.fcgi", line 22, in ?
app.publish_cgi()
File "/usr/local/lib/python2.1/site-packages/quixote/publish.py", line 658, in
publish_cgi
f = fcgi.FCGI()
File "fcgi.py", line 268, in __init__
AttributeError: FCGI instance has no attribute 'conn'
Exception exceptions.AttributeError: "FCGI instance has no attribute 'err'" in
ignored