Hi,

This question is about issues with Twisted on OSX. It might be too twistd specific, the issue has popped up in other OSX 10.6 / python contexts. So I will give it a shot.

Last year I struggled with crashes in a process using twisted.web, Quartz and OSX 10.6:
http://mail.python.org/pipermail/pythonmac-sig/2009-December/022006.html

Taking a fresh look (and some excellent help from a friend) I've managed to remove Quartz from the suspect list. The daemonising function in twisted calls fork(), but not exec(), similar to this bug:
        http://bugs.python.org/issue7895

The
USING_FORK_WITHOUT_EXEC_IS_NOT_SUPPORTED_BY_FILE_MANAGER
flag shows up in crash reports.

- Has anyone seen this specific problem with Twisted and 10.6?
- What are the best practices for dealing with this issue?
- Take it to the twisted list after all?
- Any pointers welcome!

The relevant code in twisted: _twistd_unix.py (in /twisted/scripts/). exec() - where? how?

def daemonize():
    # See http://www.erlenstar.demon.co.uk/unix/faq_toc.html#TOC16
    if os.fork():   # launch child and...
        os._exit(0) # kill off parent
    os.setsid()
    if os.fork():   # launch child and...
        os._exit(0) # kill off parent again.
    null = os.open('/dev/null', os.O_RDWR)
    for i in range(3):
        try:
            os.dup2(null, i)
        except OSError, e:
            if e.errno != errno.EBADF:
                raise
    os.close(null)


Thanks,
Erik
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to