]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
On the 2.4.x branch:
authorStefan Eissing <icing@apache.org>
Tue, 6 Jun 2017 09:08:25 +0000 (09:08 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 6 Jun 2017 09:08:25 +0000 (09:08 +0000)
Merged /httpd/httpd/trunk:r1797745

mod_http2: Fix for possible CPU busy loop introduced in v1.10.3 where a stream may keep
     the session in continuous check for state changes that never happen.

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

CHANGES
modules/http2/h2_mplx.c
modules/http2/h2_stream.h
modules/http2/h2_version.h

diff --git a/CHANGES b/CHANGES
index 9583c92d07603721716501a919b66d591061f02e..b0cfdae912851ab8a64afc342aaf038f200707e6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 
 Changes with Apache 2.4.26
 
+  *) mod_http2: Fix for possible CPU busy loop introduced in v1.10.3 where a stream may keep
+     the session in continuous check for state changes that never happen. 
+     [Stefan Eissing]
+
   *) mod_mime: Fix error checking for quoted pairs.  [Yann Ylavic]
 
   *) mod_proxy_wstunnel: Add "upgrade" parameter to allow upgrade to other
index 0520dc59145670a5ac5b7a1e0d4370b16e5a8be2..b73bd0d5bfd5a8c8d8b8e4f123f5a178e6329369 100644 (file)
@@ -1058,19 +1058,23 @@ apr_status_t h2_mplx_idle(h2_mplx *m)
                           "h2_mplx(%ld): idle, no tasks ongoing, %d streams",
                           m->id, (int)h2_ihash_count(m->streams));
             h2_ihash_shift(m->streams, (void**)&stream, 1);
-            if (stream && stream->output) {
-                /* FIXME: this looks like a race between the session thinking
-                 * it is idle and the EOF on a stream not being sent.
-                 * Signal to caller to leave IDLE state.
-                 */
-                ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c,
-                              H2_STRM_MSG(stream, "output closed=%d, mplx idle"
-                              ", out has %ld bytes buffered"),
-                              h2_beam_is_closed(stream->output),
-                              (long)h2_beam_get_buffered(stream->output));
+            if (stream) {
                 h2_ihash_add(m->streams, stream);
-                check_data_for(m, stream, 0);
-                status = APR_EAGAIN;
+                if (stream->output && !stream->out_checked) {
+                    /* FIXME: this looks like a race between the session thinking
+                     * it is idle and the EOF on a stream not being sent.
+                     * Signal to caller to leave IDLE state.
+                     */
+                    ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c,
+                                  H2_STRM_MSG(stream, "output closed=%d, mplx idle"
+                                              ", out has %ld bytes buffered"),
+                                  h2_beam_is_closed(stream->output),
+                                  (long)h2_beam_get_buffered(stream->output));
+                    h2_ihash_add(m->streams, stream);
+                    check_data_for(m, stream, 0);
+                    stream->out_checked = 1;
+                    status = APR_EAGAIN;
+                }
             }
         }
     }
index f328714951b3c4c0067ec9bd9513be4b353c426e..c3b4b844fd41381c24f94eda2e208561744e3a28 100644 (file)
@@ -89,6 +89,7 @@ struct h2_stream {
     unsigned int scheduled : 1; /* stream has been scheduled */
     unsigned int has_response : 1; /* response headers are known */
     unsigned int input_eof : 1; /* no more request data coming */
+    unsigned int out_checked : 1; /* output eof was double checked */
     unsigned int push_policy;   /* which push policy to use for this request */
     
     struct h2_task *task;       /* assigned task to fullfill request */
index 70608f3fa6ba008fb51b34a71081997eae4766b0..4e437f621fc8210f3fe68e6ba0c0747b577b222d 100644 (file)
@@ -26,7 +26,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.10.5"
+#define MOD_HTTP2_VERSION "1.10.6"
 
 /**
  * @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 0x010a05
+#define MOD_HTTP2_VERSION_NUM 0x010a06
 
 
 #endif /* mod_h2_h2_version_h */