Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CGI.pm Timeout on POST data

172 views
Skip to first unread message

Tom

unread,
May 2, 2006, 2:05:20 PM5/2/06
to
I am getting a nasty Server 500 / timeout error from about 5% of my clients
using POST method of forms. I have added logging code into the script, and
the server is hanging on the line "my $q = new CGI; ".

httpd errorlog:
[Tue Apr 18 21:06:37 2006] [error] Apache2::RequestIO::read: (70007) The
timeout specified has expired at (eval 16) line 5

Anyone seen this before? I can't reproduce it locally -- but my clients that
have the problems see it anytime they submit a form with a large amount of
POST data (i.e. more than 20 items selected in the sample script). Any
suggestions how to trace or debug this further?

CGI-Perl Version 3.16
Perl v5.8.5 built for i386-linux-thread-multi
Apache httpd 2.0.54. Tested using out-of-the-box httpd.conf
Redhat Linux FC3
Browser - IE6

Test Script:

#!/usr/bin/perl
use strict ;
$|=1 ;
use CGI qw(:standard) ;
my $q = new CGI;
# Fetch the parameter if provided
my (@biglist) = $q->param('biglist') ;
my $itemCount = $#biglist + 1 ;
# Print the HTML Header
print $q->header(-type=>'text/html', -expires=>'-1d'),
$q->start_html(-title=>'Test Form') ;
print '<h3>Select Many (30+) Items and Press Submit for Problem to
Occur</h3>' ;
print qq| Count of Items: $itemCount<br/>Items: <table width="100%"
border="1">
<tr><td>@biglist</td></tr></table>\n| ;
# Build large list of fake data
print $q->start_form() ;
my %scrollList ;
for(1..300) {
my $num = sprintf("%03d", $_) ;
$scrollList{$num} = "This is Item $num" ;
}
# Print large scrolling list and end the HTML
print $q->submit('save','Save Settings') , "<br/>PID: $$<br/>",
$q->scrolling_list(-id=>"biglist", -name=>"biglist", -values=>[sort (keys
(%scrollList)) ],
-labels=>\%scrollList, -size=>10, -multiple=>'true', -style=>"width:
320px;"),
'<br/>', $q->submit('save','Save Settings'), $q->reset(), q->end_form(),
$q->end_html() ;
exit ;


--
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html

Erika Wasser

unread,
May 3, 2006, 7:47:04 AM5/3/06
to
On Tue, 2 May 2006 12:05:20 CST, in comp.infosystems.www.authoring.cgi, "Tom" <t...@sygration.com> wrote:

>I am getting a nasty Server 500 / timeout error from about 5% of my clients
>using POST method of forms. I have added logging code into the script, and
>the server is hanging on the line "my $q = new CGI; ".
>
>httpd errorlog:
>[Tue Apr 18 21:06:37 2006] [error] Apache2::RequestIO::read: (70007) The
>timeout specified has expired at (eval 16) line 5
>
>Anyone seen this before? I can't reproduce it locally -- but my clients that
>have the problems see it anytime they submit a form with a large amount of
>POST data (i.e. more than 20 items selected in the sample script). Any
>suggestions how to trace or debug this further?
>
> CGI-Perl Version 3.16
> Perl v5.8.5 built for i386-linux-thread-multi
> Apache httpd 2.0.54. Tested using out-of-the-box httpd.conf
> Redhat Linux FC3
> Browser - IE6
>
>Test Script:
>
>#!/usr/bin/perl
> use strict ;
> $|=1 ;
> use CGI qw(:standard) ;
> my $q = new CGI;

> ...

There used to be a problem where CGI.pm would appear to get stuck in a loop
if a browser sent a value of zero in the Content-length header field

There also used to be a bug in some versions of the Microsoft browser where
the browser will sometimes send a value of zero in the Content-length
header field. As I recall, this would happen if the form was not within a
<p>

I do not know if CGI.pm was changed to handle this case. Neither do I know
whether any recent browsers have this bug

The HTML produced by your script appears to fit the above description, as
does your description of the problem, especially the fact that it happens in
the new() method. To check for this problem, add a warn() statement to print
$ENV{'CONTENT_LENGTH'} before the new() method call ...

warn "timeout test: Content-length = $ENV{'CONTENT_LENGTH'}\n";

This diagnostic will then appear in the server's error log. Look for
'Content-length = 0' followed by the timeout error. If this is the problem,
fixing it might be as simple as adding a <p> before your form

Also, your script has a bug which causes it not to print the end_form and
end_html tags

--
Erika

0 new messages