simple httplib and urllib timeout question

Oleg Broytmann phd at phd.russ.ru
Fri Apr 14 12:47:15 CEST 2000


On Fri, 14 Apr 2000, Georg Mischler wrote:
> phd at phd.russ.ru wrote:
> > Georg Mischler wrote:
> > > What exactly is your problem with signal.alarm() ?
> >
> >    Python delivers alarm only when in Python VM. If the script is
> > blocked in C (even worse - in system call), the signal will NOT be
> > delivered.
> >    Of course, URL checker, while running through a big list of URLs,
> > certainly spend most of the time in connect() and recv() system calls.
> > This makes signals unusable.
> 
> This surprises me, because the snipped I posted is in everyday
> use in something very similar to a link checker, and it works

   I wrote such link checker years ago, and first time I stucked with
timeout problem - yes, I tried to use SIGALRM, sure. That didn't work, and
Guido - many thanks - explained, that there is big problem with signal
handling in Python.

> perfectly well there. Reading throught the Python docs on

   How much URLs are you checking at once? My database is about 3000 URLs,
and I run robot over it every few days.

> signals again, I guess that the different behaviour might
> be caused by the underlying OS implementation.

   May be, but again, may be not.

> I use it on Linux (going to check on FreeBSD soon), and it looks
> like Linux will interrupt system level IO calls when a signal
> arrives for the process. What platform does it fail on for you?

   Linux. I am almost alway use Debian distro. But I tried on Sparc Solaris
with the same effect.

Oleg.
---- 
    Oleg Broytmann    http://members.xoom.com/phd2.1/    phd2 at earthling.net
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list