[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgi-list
Subject:    Re: SV: [CGI] Script timing out
From:       "Lily Y. Fu" <lily () tigr ! org>
Date:       1998-12-30 17:23:20
[Download RAW message or body]

Hi Robert,


I'd appreciate you posting an example on handling the timeout issue 
using fork, alarm() and $SIG{ALRM} as you mentioned.

Thanks,

Lily


> > Robert,
> > 
> > Thank you very much for your quick response. After adding this line to my
> > script (close to the top of the script):
> > 
> > $| = 1;
> > 
> > ...it is still doing the same thing:
> > 
> >     foreach $url (@urllist) {
> >          chomp ($url);
> >          print "<STRONG><A HREF=\"$url\"
> > TARGET=\"_new\">$url</A></STRONG><BR> \n";
> >          &submit_urls;   # <<< this is the submitter routine, slows it
> down
> > a lot
> >          print "<BR><P> \n";
> >     }
> >     print "<BR><P><STRONG>", scalar(@urllist), " URL(s)
> submitted.</STRONG>
> > <BR><P> \n";
> >     print "</BLOCKQUOTE></BLOCKQUOTE> \n";
> >     print "</BODY></HTML> \n";
> > 
> > 
> > I would expect it to print one line, pause, print another, etc., but it
> > timeouts after 60 seconds. Sorry to be a bother, but what am I doing
> wrong?
> 
>   Probably nothing. $| tells perl to flush after every print/write but what
>   happens after that is beyond the scope of your script.
> 
>   A better solution would be to use fork and run &submit_urls() as a 
>   child process. fork isn't supported on NT, but there's a module for
>   that. I think it's called Win32::Spawn.pm but I'm not sure.
> 
>   You might also want to define a maximum time for &submit_urls()
>   to complete and report a timeout to the client on failure.
>   Use alarm() and $SIG{ALRM} for that. If you (or anyone) want an 
>   example just ask and I'll post one.
> 
> hth,
> Robban
>  ~v~^~v~^~v~^~v~^~v~^~v~^~v~^~v~^~v~^~v~^~v~
> >
> >   Robert Friberg
> >   Delphi, C, Perl Developer
> >   0708 - 98 57 01
> >
>  ~v~^~v~^~v~^~v~^~v~^~v~^~v~^~v~^~v~^~v~^~v~
> 
> -----------------------------------------------------------------
> To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe cgi-list"
> in the body.
> 
> The CGI Tips & Tricks website (and archive of the list) is located
> at http://www.jann.com/Perl/
> 
> cgi-list is hosted by Summit Communication Design (http://www.summitdesign.net).
> 
> Summit Communication Design is a full-service web hosting firm
> providing web design, cgi programming and inter/intra-net support.
> -----------------------------------------------------------------
> 
-----------------------------------------------------------------
To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe cgi-list"
in the body.

The CGI Tips & Tricks website (and archive of the list) is located
at http://www.jann.com/Perl/

cgi-list is hosted by Summit Communication Design (http://www.summitdesign.net).

Summit Communication Design is a full-service web hosting firm
providing web design, cgi programming and inter/intra-net support.
-----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic