On Thu, 2014-11-06 at 09:42 -0500, David Shea wrote:
On 11/06/2014 01:30 AM, Vratislav Podzimek wrote:
> On Wed, 2014-11-05 at 17:07 -0800, Brian C. Lane wrote:
>> On Tue, Nov 04, 2014 at 11:03:49AM -0500, David Shea wrote:
>>> Some system calls are interrupted by the receipt of a signal, for us
>>> most commonly a SIGCHLD caused by a process run from a different thread,
>>> which causes the call to return -1 and set errno to EINTR, which python
>>> converts into an OSError. Handle this by retrying the call.
>> What the heck? So basically system calls aren't thread-safe when using
>> subprocess in another thread? Seems like something that ought to be
>> fixed upstream.
> subprocess is not thread-safe. Although some say it is I remember weird
> things happened when I tried to use subprocess for spawning many
> processes from many threads to check NTP server availability.
>
What kind of issues? I know there was that bug in subprocess where it
would clobber other threads' file descriptors (and caused those EBADF
problems we had sometimes), but that's been fixed upstream.
Don't know the
cause, but some processes run that way never terminated
so the threads could not be joined back.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic