Enable output buffering via $|

NEW
Assigned to

Status

()

Bugzilla
Bugzilla-General
--
enhancement
15 years ago
4 years ago

People

(Reporter: bbaetz, Assigned: bbaetz)

Tracking

Details

(Assignee)

Description

15 years ago
See bug 179174:

> I dropped that with the CGI.pm update on the basis that it wasn't generally
> needed, could theoretically slow stuff down, since apache will be doing
> buffering anyway, and that CGI::Push did set $| when it was needed
> 
> a) I forget that we weren't using CGI::Push yet, so that doesn't exactly help....
> b) When we fork in the footer for syncshadowdb, if perl has a buffer, then its
> copied into the child process, so stuff prints out twice. (This feels like a
> perl bug to me, though)
> 
> The second point generally isn't noticable, since we do templatised pages, and
> they write out in one block, so the buffer tends to be empty most of the time.
> Relying on that is really risky, though
> 
> The quick fix is to disable this again in Bugzilla::CGI.
> 
> The better fix is to:
> 
> - flush before we fork
> - turn on flushing when doing server push (either manually, or switch to
> CGI::Push, which will happen eventually anyway)
> - flush before any sytem call where the output is printed directly to the
> screen. I don't know if we do this for processmail; we used to, and may still do
> so in some places.

Bug 179174 is for the quick fix, this bug is for the better fix.

I'm also not sure that this is that much of a perf win, esp since apache is
likly to be buffering internally anyway. CGI.pm sets $|=1 for mod_perl, too,
because stdout really isn't a filehandle then.

Doing this ATM is hard, for questionable benefit; its probably better to revisit
once processmail isn't a system call, and we've killed syncshadowdb.
(Assignee)

Comment 1

15 years ago
Except for the push thing, hasn't this all been fixed? We no longer fork or do
system calls, do we?

Comment 2

13 years ago
Yeah, we no longer fork or do system calls, as far as I know.
Severity: normal → enhancement
OS: Linux → All
Hardware: PC → All

Updated

12 years ago
QA Contact: mattyt-bugzilla → default-qa

Comment 3

7 years ago
Does this mean we can now simply remove $| = 1 from Bugzilla::CGI?

Comment 4

6 years ago
I think we still want $| = 1--that *disables* output buffering, no? We want the webserver to do our buffering for us, not Perl.

Comment 5

6 years ago
Well, perlvar says:
"Setting this variable is useful primarily when you are outputting to a pipe or socket, such as when you are running a Perl program under rsh"

That's why I wonder if that's really useful in our case. And yes, $| = 1 flushes the buffer immediately.

Comment 6

6 years ago
Okay. Yeah, we pretty much are outputting to a pipe--our STDOUT is really more like a pipe to Apache's mod_cgi.
You need to log in before you can comment on or make changes to this bug.