Re: how to trap connection reset/abort in Apache::Filter?

[prev] [thread] [next] [Date index for 2005/05/12]

From: Stas Bekman
Subject: Re: how to trap connection reset/abort in Apache::Filter?
Date: 03:54 on 12 May 2005
Stas Bekman wrote:
> Jeff Ambrosino wrote:
> 
>> Ok, this is going to be tough for me to test because I'm still on RC4,
>> so it's not yet converted to the new Apache2 naming.  I'll still try
>> to make/test the svn snapshot, though (which also gives me a good
>> reason to get more familiar with subversion.)  I'll email what I find
>> out.
>>
>> thanks Stas!
> 
> 
> OK, may be just try comparing to:
> 
>   $@ == APR::Const::ECONNABORTED or $@ == APR::Const::ECONNRESET
> 
> The new subs just supposed to work on more platforms, where other 
> similar codes may be sent by the system.
> 
> You can still play with the test 
> t/protocol/TestProtocol/echo_nonblock.pm from RC4.
> 
> but looking again at your report, I can see that the issue is elsewhere.
> 
> I believe it's coming from src/modules/perl/modperl_filter.c:
> 
>     if (filter->mode == MP_INPUT_FILTER_MODE) {
>       ...
>     }
>     else {
>         MP_RUN_CROAK(modperl_output_filter_flush(filter),
>                      "Apache2::Filter");
>     }
> 
> is that it? if you change the "Apache2::Filter" string (drop the 2 in 
> your case) to something else?

If this is the case, please try this patch, I hope it applies to RC4 (I've 
dropped '2' for you)

Index: src/modules/perl/modperl_filter.c
===================================================================
--- src/modules/perl/modperl_filter.c   (revision 169708)
+++ src/modules/perl/modperl_filter.c   (working copy)
@@ -535,11 +535,15 @@
              filter->bb_in = NULL;
          }
          MP_RUN_CROAK(modperl_input_filter_flush(filter),
-                     "Apache::Filter");
+                     "Apache::Filter internal flush");
      }
      else {
-        MP_RUN_CROAK(modperl_output_filter_flush(filter),
-                     "Apache::Filter");
+        apr_status_t rc = modperl_output_filter_flush(filter);
+        if (!(rc == APR_SUCCESS            ||
+              APR_STATUS_IS_ECONNRESET(rc) ||
+              APR_STATUS_IS_ECONNABORTED(rc))) {
+            modperl_croak(aTHX_ rc, "Apache::Filter internal flush");
+        }
      }

      MP_FILTER_RESTORE_ERRSV(errsv);

I need to figure out how to write a test for this, so I can decide what's 
the right way to handle this.

        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

(message missing)

Re: how to trap connection reset/abort in Apache::Filter?
Stas Bekman 03:54 on 12 May 2005

Generated at 15:53 on 25 May 2005 by mariachi v0.52