DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29528>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29528

cgi output getting buffered causing 150MB+ memory usage

           Summary: cgi output getting buffered causing 150MB+ memory usage
           Product: Apache httpd-2.0
           Version: 2.0.49
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: All
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


httpd-2.0.49. i have no filters or anything like that defined, no mod_deflate, 
etc. 

I have a CGI that worked perfectly with 1.3.x that is now causing 2.0.x to run
out of memory. The CGI generates an MP3 file (sometimes 100+MB in size) and then
prints it to STDOUT. here is the what httpd's mem. usage looks like in top:

  PID USER      PR  NI  VIRT SWAP  RES  SHR S %CPU   TIME %MEM COMMAND
16495 apache    16   0  277m 133m 144m 133m S  0.0   0:00 14.3 httpd
11813 apache    16   0  263m 133m 130m 133m S  0.0   0:00 13.0 httpd
11812 apache    15   0  361m 232m 129m 133m S  0.0   0:01 12.9 httpd
11815 apache    16   0  333m 208m 124m 133m S  0.0   0:01 12.4 httpd
11809 apache    16   0  316m 227m  89m 133m S  0.0   0:00  8.9 httpd

If I then try to restart httpd, it seems that some child processes have become
unkillable. If use kill -9 and restart, I try to reproduce the problem, but
cannot with my broadband connection. I suspect it is slow clients on dialup
modems that is causing httpd to buffer the data???

here is the important part of what the perl CGI does:

sub send_file ($) {
  my $file = shift;
  $|=1;
  my $begin = 0;
  my $range_header = "Accept-Ranges: bytes";
  my $size = my $filesize = (stat($file))[7];
  if ($ENV{'HTTP_RANGE'} =~ /^bytes=(\d+)/) {
    $begin = $1;
    $size = $filesize - $begin;

    my $tmp = $filesize-1;
    $range_header .= "\nContent-Range: bytes $begin-$tmp/$filesize";
  }
 
  print "Content-Type: audio/mpeg
Content-Length: $size
$range_header
                                                                                
";
  open( MP3,"< $file");
  binmode MP3;
  seek(MP3, $begin, 0); # from the beginning
  while (read MP3, my $buf, 32768) {
    print STDOUT $buf;
  }
  close MP3;
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to