]> granicus.if.org Git - apache/commitdiff
use a subpool of c->pool for resources which are set aside, then clear it
authorGreg Ames <gregames@apache.org>
Fri, 8 Nov 2002 17:19:10 +0000 (17:19 +0000)
committerGreg Ames <gregames@apache.org>
Fri, 8 Nov 2002 17:19:10 +0000 (17:19 +0000)
after writing the data to the network.  This closes files sooner with
keepalive connections.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97462 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/httpd.h
server/core.c

diff --git a/CHANGES b/CHANGES
index 6b43a82a6da1640bdcb98b750b93aba351d2f3ee..729a0d105aab057732c595fed2326dba0b5b9b68 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.44
 
+  *) Fix a bug where we keep files open until the end of a 
+     keepalive connection, which can result in:
+     (24)Too many open files: file permissions deny server access
+     especially on threaded servers.  [Greg Ames, Jeff Trawick]
+
   *) Fix a bug in which mod_proxy sent an invalid Content-Length
      when a proxied URL was invoked as a server-side include within
      a page generated in response to a form POST.  [Brian Pane]
index b86dab0b4be8f17edad543e70b28de433192b291..3e026243bf2afbf31b2d6d8a1576ddbd1891e5d8 100644 (file)
@@ -1115,10 +1115,9 @@ struct server_rec {
 
 typedef struct core_output_filter_ctx {
     apr_bucket_brigade *b;
-    apr_pool_t *subpool; /* subpool of c->pool used for data saved after a
-                          * request is finished
-                          */
-    int subpool_has_stuff; /* anything in the subpool? */
+    apr_pool_t *deferred_write_pool; /* subpool of c->pool used for resources 
+                                      * which may outlive the request
+                                      */
 } core_output_filter_ctx_t;
  
 typedef struct core_filter_ctx {
index f11923059dd5bfaa33b3f79d09c7782b1427cb97..fb3010706a726776853001829596357ed67c3afb 100644 (file)
@@ -3923,7 +3923,10 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
                     }
                 }
             }
-            ap_save_brigade(f, &ctx->b, &b, c->pool);
+            if (!ctx->deferred_write_pool) {
+                apr_pool_create(&ctx->deferred_write_pool, c->pool);
+            }
+            ap_save_brigade(f, &ctx->b, &b, ctx->deferred_write_pool);
 
             return APR_SUCCESS;
         }
@@ -3994,6 +3997,14 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
         }
 
         apr_brigade_destroy(b);
+
+        /* drive cleanups for resources which were set aside 
+         * this may occur before or after termination of the request which
+         * created the resource
+         */
+        if (ctx->deferred_write_pool) {
+            apr_pool_clear(ctx->deferred_write_pool);  
+        }
         if (rv != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_INFO, rv, c->base_server,
                          "core_output_filter: writing data to the network");