[Pythonmac-SIG] Fwd: [Twisted-Python] _twistd_unix.py / daemonize() / OSX / USING_FORK_WITHOUT_EXEC_IS_NOT_SUPPORTED_BY_FILE_MANAGER

Erik van Blokland erik at letterror.com
Wed Oct 13 21:31:28 CEST 2010



Begin forwarded message:

> From: James Y Knight <foom at fuhm.net>
> Date: October 13, 2010 7:20:20 PM GMT+02:00
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Subject: Re: [Twisted-Python] _twistd_unix.py / daemonize() / OSX / USING_FORK_WITHOUT_EXEC_IS_NOT_SUPPORTED_BY_FILE_MANAGER
> Reply-To: Twisted general discussion <twisted-python at twistedmatrix.com>
> 
> 
> On Oct 13, 2010, at 12:05 PM, Erik van Blokland wrote:
> 
>> 
>> On Oct 13, 2010, at 5:52 PM, Phil Mayers wrote:
>> 
>>> Other info indicates this is Apple trying to be clever and "protect" 
>>> applications from some signal handling issues surrounding fork() with 
>>> libraries which aren't safe in that situation; presumably these are 
>>> MacOS-specific libraries?
>>> 
>>> If this really is true, then MacOS X is no longer posix-compliant in 
>>> those circumstances, and Twisted is going to need some work :o(
>>> 
>>> Can you share more details about the application; the context in which 
>>> it is started, and which system libraries it's likely to load?
>> 
>> Here's a compact version. The script uses OSX' Quartz to create and manipulate images. Twisted is used to wrap it as a webserver, images are served. More pointers on how to start and use it in the script itself.
> 
> You need to avoid using or importing any OSX APIs until after the daemonization has occurred. Unfortunately, twisted executes the entire script file before daemonizing. [that's unfortunate for other reasons besides this, too]
> 
> Here's a corrected version of your script which works properly. It defers importing Quartz until the reactor is running, by moving it into a function called by reactor.callWhenRunning().
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20101013/3c0a1068/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twisted.quartz.test.py
Type: text/x-python-script
Size: 5042 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20101013/3c0a1068/attachment-0001.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20101013/3c0a1068/attachment-0003.html>


More information about the Pythonmac-SIG mailing list