Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

ERROR on CGI script:The timeout specified has expired

by Anonymous Monk
on Nov 24, 2009 at 13:53 UTC ( #809078=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

My CGI script runs little long to complete and due to which every time I run, I am getting the below error:

[error] [client 127.0.0.1] (70007)The timeout specified has expired: a +p_content_length_filter: apr_bucket_read() failed, referer: http://lo +calhost/cgi-bin/firstpage.cgi

I tried redirecting STDERR or specifing refresh time in cgi script as header(-refersh='300s') but no luck (I searched in google about this error and found the tips that redirecting the STDERR solves the issue), I am still gettign the same error and my page is geeting expired or script is not completing at all. Did anyone encountered the same before? Is there any way to get rid of these? Will appreciate if you can give any idea on this.

Thanks.

Replies are listed 'Best First'.
Re: ERROR on CGI script:The timeout specified has expired
by bellaire (Hermit) on Nov 24, 2009 at 14:08 UTC

    According to this bug report for Apache, this problem is usually generated when your script is dumping a lot of data to STDERR. Alternatively, it can happen when apache is waiting for large chunks of data on STDOUT as well.

    It seems you need to find some way to reduce the volume of output produced by your script.

      Hi bellaire,

      Thanks for your suggestion. I understood, this is the bug report I was talking about .. saw it after checing in google. Acually my cgi script is not doing anything fancy, it's running a query (little complex)to Database and the returned data is getting used to generate the output, which in turn I am displaying in page. It's mainly waiting for the query result and before the query completes it's expiring. As, per your comment ... I can't exclude this query ... is there any other way?

      Thanks.

        Not that I know of, but I only know what the Apache folks said on that bug report. Try running your query from the command line. The bug report suggests that the timeout isn't actually because your script takes 300sec to execute, but because the volume of output it produces breaks Apache's attempts to keep up with it.

        I'd suggest running your script on the command line to determine:

        • Does it really take >5 minutes to run?
        • How much output is sent to STDOUT/STDERR?
        That should give you a better idea of what you can reduce (time or output).

        You can check the Apache "Timeout" directive. However, how long does it take to run the query in A SQL Console?

        Are you sure that ur not generating a lot of STDERR output?

        A contentious debate is always associated with a lack of valid arguments.
Re: ERROR on CGI script:The timeout specified has expired
by Anonymous Monk on Nov 24, 2009 at 16:01 UTC

      Thank You all, thanks for your suggestion on this. I have find it out...that it's expiring due to load on STDOUT (it was waiting for data on STDOUT).Happy Thanksgiving

Re: ERROR on CGI script:The timeout specified has expired
by gwhite (Friar) on Nov 24, 2009 at 15:16 UTC

    When I process a lot of data with one of my CGI scripts I will do this every couple of hundred records

    print "\0";

    g_White

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://809078]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2020-11-01 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (291 votes). Check out past polls.

    Notices?