You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by David MacKenzie <dj...@pix.net> on 2002/02/01 04:59:35 UTC
mod_cgi/9676: reading from CGI programs is very inefficient
>Number: 9676
>Category: mod_cgi
>Synopsis: reading from CGI programs is very inefficient
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apache
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Thu Jan 31 20:00:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: djm@pix.net
>Release: 2.0.18 and CVS
>Organization:
apache
>Environment:
Unix (BSDI BSD/OS 4.3)
>Description:
Apache 2 does at least one read() system call for every byte that it reads from a CGI program. Ouch! It seems that the stream is unbuffered and apr_file_gets() calls apr_file_read() once per byte; including timeouts, it can be more than one read() per byte!
>How-To-Repeat:
Add some diagnostics to srclib/apr/file_io/unix/readwrite.c or do a system call trace when running a simple CGI program (e.g., printenv).
>Fix:
Perhaps there's some confusion between nonblocking and unbuffered. Although the CGI pipe may have to be nonblocking, is there any reason that apr_file_read() shouldn't read ahead and buffer as much as it can get (up to some arbitrary limit), even when it's only being asked for 1 byte at a time?
>Release-Note:
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or ]
["Re: general/1098:"). If the subject doesn't match this ]
[pattern, your message will be misfiled and ignored. The ]
["apbugs" address is not added to the Cc line of messages from ]
[the database automatically because of the potential for mail ]
[loops. If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request from a ]
[developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]