When daemonizing a Quixote site that uses sessions, you have to put

    os._urandomfd = None

after the fork call.  Otherwise you'll get a "bad file descriptor" error
on some systems.  It happened specifically on Mac OS X 10.3.9 (Python
2.4.1), but not on my Linux development system.  Something else apparently
calls os.urandom() early at Python startup, and it opens /dev/urandom and
puts the file descriptor in the _urandom global.  But after a fork the
file descriptor is invalid, so you have to reset it to make it open the
file again.  Otherwise an innocent user comes along and Quixote tries to
create a random session ID and blammo!

My daemonizing module is at http://cafepy.com/quixote_extras/rex/toplevel.py
Append "?download=1" for download-friendly format.
It has several command-line options (--simple, --scgi, --daemon, --pidfile,
--stop, --user, --group) but requires a 'config' module in a specific
format.  This could be made generic with some minimal work.

-- 
-- Mike Orr <[EMAIL PROTECTED]>

_______________________________________________
Quixote-users mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/quixote-users

Reply via email to