httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grega...@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Wed, 13 Nov 2002 15:07:35 GMT
gregames    2002/11/13 07:07:35

  Modified:    server   core.c
  Log:
  core_output_filter: use the current input brigade's pool for the "more"
  brigade when we defer network writes due to small data + keepalives.  This
  prevents leaking resources in the "more" brigade until the end of the
  connection.
  
  Revision  Changes    Path
  1.224     +10 -13    httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.223
  retrieving revision 1.224
  diff -u -r1.223 -r1.224
  --- core.c	11 Nov 2002 21:08:26 -0000	1.223
  +++ core.c	13 Nov 2002 15:07:35 -0000	1.224
  @@ -3670,6 +3670,7 @@
       core_net_rec *net = f->ctx;
       core_output_filter_ctx_t *ctx = net->out_ctx;
       apr_read_type_e eblock = APR_NONBLOCK_READ;
  +    apr_pool_t *input_pool = b->p;
   
       if (ctx == NULL) {
           ctx = apr_pcalloc(c->pool, sizeof(*ctx));
  @@ -3998,35 +3999,31 @@
           }
   
           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) {
  -            if (more) {
  +            if (more && more->p == ctx->deferred_write_pool) {
  +                /* "more" belongs to the deferred_write_pool,
  +                 * which is about to be cleared.
  +                 */
                   if (APR_BRIGADE_EMPTY(more)) {
  -                    /* the usual case - prevent the next loop iteration
  -                     * from referencing a brigade which lives in a
  -                     * cleared pool
  -                     */
                       more = NULL;
                   }
                   else {
  -                    /* change the lifetime of "more" to the connection's
  -                     * lifetime
  -                     *
  -                     * XXX a shorter lifetime would be better for long-running
  -                     * keep-alive connections...might be able to use the
  -                     * input brigade's pool
  +                    /* uh oh... change more's lifetime 
  +                     * to the input brigade's lifetime 
                        */
                       apr_bucket_brigade *tmp_more = more;
                       more = NULL;
  -                    ap_save_brigade(f, &more, &tmp_more, c->pool);
  +                    ap_save_brigade(f, &more, &tmp_more, input_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");
  
  
  

Mime
View raw message