Tom Schindl wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Stas Bekman wrote:
Stas Bekman wrote:
Philip M. Gollucci wrote:
[...]
6. Okay so from the 4 above attached files in #5 it looks like
PerlIOApache_flush() is being called, but not working.
[I'll list this function at the end of the e-mail.]
Basically, I think there is a SNAFU here
MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE), ":Apache2
IO flush");
That FALSE ends up being add_flush_bucket so even though we call
flush we never get a flush bucket!!!!!!
I think your observation and the fix are correct Philip. But before we
commit any fix we need to have a test that breaks and the fix fixes it.
As I think more about it, there was a reason for this FALSE setting. As
you know Apache will send headers as soon as it gets some data out and a
flush bucket is by Apache-talk is data. So what was happening is that
when users were doing something in their code that was causing perl to
flush STDOUT behind the scenes (like a filehandle dup), Apache will go
and generate the headers even if the user haven't had a chance to set
those. That's why it was written in such a way: i.e. add a flush bucket
only if there is some data to flush, otherwise you need to call
$r->flush if you want the flush to be sent anyway.
Stas if I get you right you say that the actual behaviour of "undef $|"
is desired and not a failure (I can somehow remember now the discussion)
Thinking more about it we need a better fix. Currently
modperl_wbucket_flush is not flexible enough. What PerlIOApache_flush
needs is:
- if there is data to flush, flush it and *unconditionaly* append the
flush bucket
- if there is no data to flush do nothing.
modperl_wbucket_flush itself needs to have the other two cases that it
supports now.
a quick temp fix would be:
Index: src/modules/perl/modperl_io_apache.c
===================================================================
--- src/modules/perl/modperl_io_apache.c (revision 293536)
+++ src/modules/perl/modperl_io_apache.c (working copy)
@@ -170,9 +170,11 @@
rcfg->wbucket->outbuf,
rcfg->wbucket->outcnt));
- MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE),
- ":Apache2 IO flush");
-
+ if (rcfg->wbucket->outcnt) {
+ MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, TRUE),
+ ":Apache2 IO flush");
+ }
+
return 0;
}
I think this is the desired behavior. We need a test for this case. Does
it do the trick? If so, then modperl_wbucket_flush needs more work (that
if() doesn't belong here, but to modperl_wbucket_flush.
I didn't get an answer when I asked if $r->flush does what the user
wanted too. Maybe I should ask again I've been only guessing.
Sorry Tom, I have not read that question, I still have tons of emails to
catch up with. Ideally, send here a new test that fails and we will be
much quicker to look at it/fix it.
We should at least document the behaviour? I'd generate a fix for the
docs if my assumption is correct.
--
_______________________________________________________________
Stas Bekman mailto:[EMAIL PROTECTED] | http://stason.org/
MailChannels: Assured Messaging (TM) | http://mailchannels.com/
The "Practical mod_perl" book | http://modperlbook.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]