On Nov 3, 2010, at 10:23 PM, exar...@twistedmatrix.com wrote:
> On 01:45 am, ndbeck...@gmail.com wrote:
>> On modern linux, signalfd can be used to convert sigchld into an event 
>> on a
>> file descriptor.  Looks like just what is wanted for processProtocol.
> 
> It does, indeed.  I'm not sure it's really worth bothering though.  Here 
> are the drawbacks of using signalfd():
> 
>   - It only works on Linux
>   - It works differently on older versions of Linux than on newer 
> versions
>   - You still can't have another SIGCHLD handler installed that will 
> called (so it's not any more cooperative with other library code)

Another drawback is that spawned subprocesses will start with SIGCHLD blocked 
(because the sigprocmask is inherited across fork/exec, like SIG_IGN is, but 
unlike signal handlers), unless twisted adds a pthread_atfork handler (which 
there is no way to do from Python, so that'd have to be more custom C code). 
And even with that, system() would still remain broken, because system() 
inexplicably doesn't call atfork handlers on linux/glibc (notabug according to 
glibc maintainers).

Of course, the Twisted process API could unblock SIGCHLD itself before calling 
exec, but this would leave spawning a process with any other API 
(subprocess/etc) broken. Many programs will not react well to starting with 
SIGCHLD blocked.

Since Twisted just recently managed to make spawning subprocesses with 
non-Twisted APIs actually work right, it'd be quite poor to break that again.

James
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to