perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steve...@apache.org
Subject svn commit: r1124132 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_error.h src/modules/perl/modperl_filter.c src/modules/perl/modperl_io_apache.c xs/Apache2/RequestIO/Apache2__RequestIO.h
Date Wed, 18 May 2011 09:30:00 GMT
Author: stevehay
Date: Wed May 18 09:30:00 2011
New Revision: 1124132

URL: http://svn.apache.org/viewvc?rev=1124132&view=rev
Log:
PerlIOApache_flush() and mpxs_Apache2__RequestRec_rflush() now no longer throw exceptions
when modperl_wbucket_flush() fails if the failure was just a reset connection or an aborted
connection. The failure is simply logged to the error log instead. This should fix cases of
httpd.exe crashing when users press the Stop button in their web browsers.

Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/src/modules/perl/modperl_error.h
    perl/modperl/trunk/src/modules/perl/modperl_filter.c
    perl/modperl/trunk/src/modules/perl/modperl_io_apache.c
    perl/modperl/trunk/xs/Apache2/RequestIO/Apache2__RequestIO.h

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/Changes?rev=1124132&r1=1124131&r2=1124132&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Wed May 18 09:30:00 2011
@@ -12,6 +12,13 @@ Also refer to the Apache::Test changes l
 
 =item 2.0.6-dev
 
+PerlIOApache_flush() and mpxs_Apache2__RequestRec_rflush() now no longer throw
+exceptions when modperl_wbucket_flush() fails if the failure was just a reset
+connection or an aborted connection. The failure is simply logged to the error
+log instead. This should fix cases of httpd.exe crashing when users press the
+Stop button in their web browsers.
+[Steve Hay]
+
 Fixed a few issues that came up with LWP 6.00:
 - t/response/TestAPI/request_rec.pm assumes HTTP/1.0 but LWP 6 uses 1.1
 - t/api/err_headers_out.t fails due to a bug somewhere in LWP 6

Modified: perl/modperl/trunk/src/modules/perl/modperl_error.h
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_error.h?rev=1124132&r1=1124131&r2=1124132&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_error.h (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_error.h Wed May 18 09:30:00 2011
@@ -45,4 +45,20 @@ void modperl_croak(pTHX_ apr_status_t rc
         }                                                    \
     } STMT_END
 
+#define MP_RUN_CROAK_RESET_OK(s, rc_run, func) STMT_START               \
+    {                                                                   \
+        apr_status_t rc = rc_run;                                       \
+        if (rc != APR_SUCCESS) {                                        \
+            if (APR_STATUS_IS_ECONNRESET(rc) ||                         \
+                APR_STATUS_IS_ECONNABORTED(rc)) {                       \
+                ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,              \
+                             "%s got: %s", func,                        \
+                             modperl_error_strerror(aTHX_ rc));         \
+            }                                                           \
+            else {                                                      \
+                modperl_croak(aTHX_ rc, func);                          \
+            }                                                           \
+        }                                                               \
+    } STMT_END
+
 #endif /* MODPERL_ERROR_H */

Modified: perl/modperl/trunk/src/modules/perl/modperl_filter.c
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_filter.c?rev=1124132&r1=1124131&r2=1124132&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_filter.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_filter.c Wed May 18 09:30:00 2011
@@ -472,24 +472,6 @@ static int modperl_run_filter_init(ap_fi
     return status;
 }
 
-
-#define MP_RUN_CROAK_RESET_OK(func)                                     \
-    {                                                                   \
-        apr_status_t rc = func(filter);                                 \
-        if (rc != APR_SUCCESS) {                                        \
-            if (APR_STATUS_IS_ECONNRESET(rc) ||                         \
-                APR_STATUS_IS_ECONNABORTED(rc)) {                       \
-                ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,              \
-                             "Apache2::Filter internal flush got: %s",  \
-                             modperl_error_strerror(aTHX_ rc));         \
-            }                                                           \
-            else {                                                      \
-                modperl_croak(aTHX_ rc,                                 \
-                              "Apache2::Filter internal flush");        \
-            }                                                           \
-        }                                                               \
-    }
-
 int modperl_run_filter(modperl_filter_t *filter)
 {
     AV *args = Nullav;
@@ -563,10 +545,12 @@ int modperl_run_filter(modperl_filter_t 
             apr_brigade_destroy(filter->bb_in);
             filter->bb_in = NULL;
         }
-        MP_RUN_CROAK_RESET_OK(modperl_input_filter_flush);
+        MP_RUN_CROAK_RESET_OK(s, modperl_input_filter_flush(filter),
+                              "Apache2::Filter internal flush");
     }
     else {
-        MP_RUN_CROAK_RESET_OK(modperl_output_filter_flush);
+        MP_RUN_CROAK_RESET_OK(s, modperl_output_filter_flush(filter),
+                              "Apache2::Filter internal flush");
     }
 
     MP_FILTER_RESTORE_ERRSV(errsv);

Modified: perl/modperl/trunk/src/modules/perl/modperl_io_apache.c
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_io_apache.c?rev=1124132&r1=1124131&r2=1124132&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_io_apache.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_io_apache.c Wed May 18 09:30:00 2011
@@ -169,8 +169,9 @@ PerlIOApache_flush(pTHX_ PerlIO *f)
                                   rcfg->wbucket->outbuf,
                                   rcfg->wbucket->outcnt));
 
-    MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE),
-                 ":Apache2 IO flush");
+    MP_RUN_CROAK_RESET_OK(st->r->server,
+                          modperl_wbucket_flush(rcfg->wbucket, FALSE),
+                          ":Apache2 IO flush");
 
     return 0;
 }

Modified: perl/modperl/trunk/xs/Apache2/RequestIO/Apache2__RequestIO.h
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/xs/Apache2/RequestIO/Apache2__RequestIO.h?rev=1124132&r1=1124131&r2=1124132&view=diff
==============================================================================
--- perl/modperl/trunk/xs/Apache2/RequestIO/Apache2__RequestIO.h (original)
+++ perl/modperl/trunk/xs/Apache2/RequestIO/Apache2__RequestIO.h Wed May 18 09:30:00 2011
@@ -179,8 +179,9 @@ void mpxs_Apache2__RequestRec_rflush(pTH
                rcfg->wbucket->outcnt,
                apr_pstrmemdup(rcfg->wbucket->pool, rcfg->wbucket->outbuf,
                               rcfg->wbucket->outcnt));
-    MP_RUN_CROAK(modperl_wbucket_flush(rcfg->wbucket, TRUE),
-                 "Apache2::RequestIO::rflush");
+    MP_RUN_CROAK_RESET_OK(r->server,
+                          modperl_wbucket_flush(rcfg->wbucket, TRUE),
+                          "Apache2::RequestIO::rflush");
 }
 
 static MP_INLINE long mpxs_ap_get_client_block(pTHX_ request_rec *r,



Mime
View raw message