Debugging segmentation faults

John Nagle nagle at animats.com
Wed Mar 7 23:45:00 EST 2007


George Sakkis wrote:
> On Mar 7, 4:15 pm, John Nagle <n... at animats.com> wrote:
> 
> 
>>    You're using Python on a web server to do something
>>complicated.  You must suffer.
>>
>>    Are you trying to fork off a subprocess in a multithreaded
>>program?  That's unlikely to work.  The sematics differ
>>from OS to OS (Solaris forks all the threads, most other
>>operating systems don't; most UNIX-based OSs copy all the
>>open file descriptors, but some give you control of which
>>open files are passed), and Python may not be thread-safe
>>in that area.
> 
> 
> I see the potential problem in general, but in my case every thread is
> exclusively responsible for the subprocesses it forks; no subprocess
> is inherited from the main thread or is shared in among the worker
> threads.

    Forking itself may not be thread safe.  Forking is a process-level
operation, for historical reasons.

					John Nagle



More information about the Python-list mailing list