Help: /bin/ping problem with Red Hat

Michael Hudson mwh at python.net
Wed Mar 12 11:33:18 EST 2003


Vivek Sawant <vivek-nospam at cs.unc.edu> writes:

> Looks like this has something to do with Linux threading in general or
> perhaps python threading in particular.
> 
> I scripted a simple python program to invoke the following command line
> and ping terminated as expected. If I create a thread and get it
> to invoke the following command line, it blocks forever and does not
> terminate as directed using the -w option.
> 
> Does this have something to with alarm/signal. Perhaps the ping running
> within this thread does not get its signals delivered to it properly?
> 
> What do you guys think?

That'll be it: non-main Python threads on (at least) linux have "block
everything" signal masks[1], which get inherited on exec()...

It would be possible to get Python's os.exec* functions to restore a
more sensible signal mask, but harder for os.system().

Threads + signals = a huge mess, in my experience.

Cheers,
M.

[1] I presume there's a reason for this, but I don't know what it
    is...

-- 
  nonono,  while we're making wild  conjectures about the behavior
  of completely irrelevant tasks, we must not also make serious
  mistakes, or the data might suddenly become statistically valid.
                                        -- Erik Naggum, comp.lang.lisp




More information about the Python-list mailing list