]> granicus.if.org Git - apache/commitdiff
Merge of 1736463 from trunk:
authorStefan Eissing <icing@apache.org>
Thu, 24 Mar 2016 16:47:26 +0000 (16:47 +0000)
committerStefan Eissing <icing@apache.org>
Thu, 24 Mar 2016 16:47:26 +0000 (16:47 +0000)
mod_http2: fix for scoreboard updates missing, mem leak fix for slave connections

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1736465 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http2/h2_io.c
modules/http2/h2_mplx.c
modules/http2/h2_task.c
modules/http2/h2_task_output.c
modules/http2/h2_version.h

diff --git a/CHANGES b/CHANGES
index 80353a741bb45df1743dbaa771db95998d9f8d7b..58033bfb7a085279956a33755974c5d2a1f19d85 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.20
 
+  *) mod_http2: fix for missing score board updates on request count, fix for
+     memory leak on slave connection reuse.
+     
   *) mod_http2: Fix build on Windows from dsp files.
      [Stefan Eissing] 
 
index 0beb85606daf50c48ec90640a676aba3664e1de3..3b36ca181ea1050064d06600739c2d88f833bfd9 100644 (file)
@@ -425,16 +425,6 @@ apr_status_t h2_io_out_write(h2_io *io, apr_bucket_brigade *bb,
         return APR_ECONNABORTED;
     }
 
-    if (io->eos_out) {
-        apr_off_t len = 0;
-        /* We have already delivered an EOS bucket to a reader, no
-         * sense in storing anything more here.
-         */
-        apr_brigade_length(bb, 0, &len);
-        apr_brigade_cleanup(bb);
-        return (len > 0)? APR_EOF : APR_SUCCESS;
-    }
-
     /* Filter the EOR bucket and set it aside. We prefer to tear down
      * the request when the whole h2 stream is done */
     for (b = APR_BRIGADE_FIRST(bb);
index 5c2319ce94593db9557e784c10e0fe78f2933fff..00a64ecf2a8abb1c1da0750bcb6acb175c9667b5 100644 (file)
@@ -279,6 +279,8 @@ static int io_out_consumed_signal(h2_mplx *m, h2_io *io)
 
 static void io_destroy(h2_mplx *m, h2_io *io, int events)
 {
+    int reuse_slave;
+    
     /* cleanup any buffered input */
     h2_io_in_shutdown(io);
     if (events) {
@@ -297,12 +299,16 @@ static void io_destroy(h2_mplx *m, h2_io *io, int events)
         h2_io_set_remove(m->redo_ios, io);
     }
 
+    reuse_slave = ((m->spare_slaves->nelts < m->spare_slaves->nalloc)
+                    && !io->rst_error && io->eor);
     if (io->task) {
         conn_rec *slave = io->task->c;
         h2_task_destroy(io->task);
         io->task = NULL;
         
-        if (m->spare_slaves->nelts < m->spare_slaves->nalloc) {
+        if (reuse_slave) {
+            apr_bucket_delete(io->eor);
+            io->eor = NULL;
             APR_ARRAY_PUSH(m->spare_slaves, conn_rec*) = slave;
         }
         else {
@@ -310,10 +316,6 @@ static void io_destroy(h2_mplx *m, h2_io *io, int events)
         }
     }
 
-    if (io->eor) {
-        apr_bucket_delete(io->eor);
-        io->eor = NULL;
-    }
     if (io->pool) {
         apr_pool_destroy(io->pool);
     }
@@ -1121,6 +1123,8 @@ h2_task *h2_mplx_pop_task(h2_mplx *m, int *has_more)
 static void task_done(h2_mplx *m, h2_task *task, h2_req_engine *ngn)
 {
     if (task) {
+        h2_io *io = h2_io_set_get(m->stream_ios, task->stream_id);
+        
         if (task->frozen) {
             /* this task was handed over to an engine for processing 
              * and the original worker has finished. That means the 
@@ -1133,8 +1137,6 @@ static void task_done(h2_mplx *m, h2_task *task, h2_req_engine *ngn)
             apr_thread_cond_broadcast(m->task_thawed);
         }
         else {
-            h2_io *io = h2_io_set_get(m->stream_ios, task->stream_id);
-            
             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c,
                           "h2_mplx(%ld): task(%s) done", m->id, task->id);
             /* clean our references and report request as done. Signal
index b273a05c2b32e5cad8128ab00001dc4f60440381..9fa69b2365a1851b4191cd9e43a048832338745c 100644 (file)
@@ -269,7 +269,6 @@ static apr_status_t h2_task_process_request(h2_task *task, conn_rec *c)
                       "h2_task(%s): create request_rec failed, r->status=%d", 
                       task->id, r->status);
     }
-    c->sbh = NULL;
 
     return APR_SUCCESS;
 }
index a15a80cf713c23adc761c11875b48aa456b0b539..959398d1d10bbe1e6c79cecd99ddef8d62d8eb1f 100644 (file)
@@ -20,6 +20,7 @@
 #include <http_core.h>
 #include <http_log.h>
 #include <http_connection.h>
+#include <http_request.h>
 
 #include "h2_private.h"
 #include "h2_conn.h"
@@ -136,6 +137,7 @@ static apr_status_t write_brigade_raw(h2_task_output *output,
 apr_status_t h2_task_output_write(h2_task_output *output,
                                   ap_filter_t* f, apr_bucket_brigade* bb)
 {
+    apr_bucket *b;
     apr_status_t status = APR_SUCCESS;
     
     if (APR_BRIGADE_EMPTY(bb)) {
@@ -147,6 +149,16 @@ apr_status_t h2_task_output_write(h2_task_output *output,
     if (output->task->frozen) {
         h2_util_bb_log(output->task->c, output->task->stream_id, APLOG_TRACE2,
                        "frozen task output write, ignored", bb);
+        while (!APR_BRIGADE_EMPTY(bb)) {
+            b = APR_BRIGADE_FIRST(bb);
+            if (AP_BUCKET_IS_EOR(b)) {
+                /* TODO: keep it */
+                APR_BUCKET_REMOVE(b);
+            }
+            else {
+                apr_bucket_delete(b);
+            }
+        }
         return APR_SUCCESS;
     }
     
index 836aa074680a56b3b048743519a52317b6d9b012..1b961c51e7cb8887b8797df51cd3247ba52e10d7 100644 (file)
@@ -26,7 +26,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.4.4"
+#define MOD_HTTP2_VERSION "1.4.5"
 
 /**
  * @macro
@@ -34,7 +34,7 @@
  * release. This is a 24 bit number with 8 bits for major number, 8 bits
  * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
  */
-#define MOD_HTTP2_VERSION_NUM 0x010404
+#define MOD_HTTP2_VERSION_NUM 0x010405
 
 
 #endif /* mod_h2_h2_version_h */