Tom Schindl wrote:
Could someone please clarify this problem before releasing:
http://www.gossamer-threads.com/lists/modperl/modperl/84625?nohighlight=1#84625

I'm probably going to screw up the way I say this, but here we go.
All files (11) mentioned are available here:
  http://p6m7g8.net/MP2/84625

1.  perl 5.8.7 w/out ithreads with PerlIO / apache 2.0.54 apr not threaded / 
mp2-svn

2.  install Apache2::DebugFilter from CPAN

3.  2 test scripts:
        first uses print
                you can run me under cgi and mp2 / registry
        second use $r->print
                you can run me under mp2 registry

4. 3 runs of this script with the following configs in httpd.conf
        PerlModule Apache2::DebugFilter
        PerlOutputFilterHandler Apache2::DebugFilter::snoop_connection
        Alias  /perl-bb/ /usr/home/pgollucci/httpd/2.0.54/prefork/perl-bb/
        <Location /perl-bb/>
                SetHandler perl-script
                PerlResponseHandler ModPerl::RegistryBB
                Options +ExecCGI
                Allow from all
        </Location>

        cgi_log - flush.cgi  run under mod_cgi              (works as expected)
        mp2_log - flush.cgi  run under ModPerl::RegistryBB  (doesn't work as 
expected)
        mp2_api - flush2.cgi run under ModPerl::RegistryBB  (works as expected)

        You can clearly see that the FLUSH buckets don't get sent in the 
mp2_log.

        Some reading first
           http://perl.apache.org/docs/2.0/api/Apache2/RequestIO.html#C_rflush_
           
http://perl.apache.org/docs/2.0/user/config/config.html#C_perl_script_
           
http://perl.apache.org/docs/2.0/user/coding/coding.html#Generating_HTTP_Response_Headers

5.   pradeep.smani at gmai
     
http://www.gossamer-threads.com/lists/modperl/modperl/84625?nohighlight=1#84625
     found the right underlying function here modperl_wbucket_pass()

      I can illustrate this by turning off the Apache2::Debug configs above
      and enabling tracing assuming I turned it on via  MP_TRACE=1 in the 
Makefile.PL step.
      So to httpd.conf I add
         PerlTrace fo
           [Thats filter and I/O Tracing]

        [there is no tracing of filters under mod_cgi]
        mp2_trace       - flush.cgi under ModPerl::RegistryBB
        mp2_api_trace   - flush2.cgi ModPerl::RegistryBB
        mp2_trace_0     - flush.cgi under ModPerl::RegistryBB $|= 0
        mp2_api_trace_0 - flush2.cgi under ModPerl::RegistryBB $|= 0

        RE:84625
           The reason why seeting the add_flush_bucket variable "fixes" this is 
because it adds a FLUSH bucket to the
           output bucket brigade (you can see these were "missing" in the files 
from #4). This variable is set
           in modperl_filter.c:get_bucket(modperl_filter_t *filter)
                in

     else if (MP_FILTER_IS_FLUSH(filter)) {
        MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
                   "read in: FLUSH bucket\n",
                   MP_FILTER_NAME(filter->f));
        filter->flush = 1;
        return 0;
    }

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!!!!!!

Apply this diff
Index: modperl_io_apache.c
===================================================================
--- modperl_io_apache.c (revision 292912)
+++ modperl_io_apache.c (working copy)
@@ -170,7 +170,7 @@
                                   rcfg->wbucket->outbuf,
                                   rcfg->wbucket->outcnt));

-    MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE),
+    MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, TRUE),
                  ":Apache2 IO flush");

     return 0;

recompile yada yada

        mp2_trace       - flush.cgi under ModPerl::RegistryBB (NOW WORKS)
        mp2_api_trace   - flush2.cgi ModPerl::RegistryBB

        However, this needs to be conditionalized on $| which I've no idea how 
to test for in XS yet.  Also, this sends         
        a separate bucket briade (bb) with just a FLUSH bucket.  This case is 
avoided because of the extra
        overhead. FYI, the test suite still passes with this.  I'm not quite 
sure how though, I thought sure it should
        have broken some of the header parsing.

        I have don't think this is the correct solution, more likely, I think 
this might be a bug in PerlIO Layers in
                PERL itself?


HTH


--
END
------------------------------------------------------------
    What doesn't kill us can only make us stronger.
                Nothing is impossible.
                                
Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
       http://www.liquidation.com
       http://www.uksurplus.com
       http://www.govliquidation.com
       http://www.gowholesale.com


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

Reply via email to