Help: /bin/ping problem with Red Hat
vivek-nospam at cs.unc.edu
Wed Mar 12 17:11:16 CET 2003
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?
Vivek Sawant wrote:
> I am having a peculiar problem with the /bin/ping program. I am running
> Red Hat with Kernel 2.4.18-19.7.xsmp. Ping to a non-responsive (down)
> host does not terminate when invoked from my python application even
> though I use the timeout (-w) flag. Details:
> My Python application has two threads: a main thread and another created
> by the main thread. The second thread invokes the following ping command
> using os.system () of Python.
> /bin/ping -c 3 -s 548 -p "0003a8e4" -w 3 -l 3 <destination>
> The stdout and stderr of this command has been redirected to a file.
> For a destination that is down (does not respond to pings), the above
> command never terminates while it is supposed to after 3 seconds (-w 3).
> If I cut and paste the above command at the command line, it terminates
> after 3 seconds as expected even though the destination does not
> echo back any of the packets.
> If I kill the above ping command using 'kill -9', the rest of my app
> logic behaves like the ping has terminated. Also, for the destinations
> that respond to ping, the app is behaving normally. So, I don't think
> there is any problem with my prorgam logic.
> While the ping thread is pinging, the main thread periodically reads a
> file to see if the user has signalled termination of application. This
> thread gets periodically scheduled even when the ping thread is stuck as
> described above.
> Does anyone have any insight about what's going on here. I am hopelessly
> stuck :-(
More information about the Python-list