]> granicus.if.org Git - apache/commitdiff
On the trunk:
authorStefan Eissing <icing@apache.org>
Mon, 4 Sep 2017 15:10:59 +0000 (15:10 +0000)
committerStefan Eissing <icing@apache.org>
Mon, 4 Sep 2017 15:10:59 +0000 (15:10 +0000)
  *) mod_http2: DoS flow control protection is less agressive as long as active tasks stay
     below worker capacity. Intended to fix problems with media streaming.

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

CHANGES
modules/http2/h2_mplx.c

diff --git a/CHANGES b/CHANGES
index bb8a953107fde3b6d475759d76861fcd6872b1ac..10ae87660a00219bbe9f9ce25bcf24368e8d8b54 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_http2: DoS flow control protection is less agressive as long as active tasks stay
+     below worker capacity. Intended to fix problems with media streaming. [Stefan Eissing]
+     
   *) mod_md: v0.9.0:
      Certificate provisioning from Let's Encrypt (and other ACME CAs) for mod_ssl virtual hosts.
      [Stefan Eissing]
index c360faf97284bf0b016888717694639633d3dfbd..12300fc3346796725554fc4a53f5ab94fcd1dfa1 100644 (file)
@@ -968,19 +968,29 @@ static h2_stream *get_timed_out_busy_stream(h2_mplx *m)
 static apr_status_t unschedule_slow_tasks(h2_mplx *m) 
 {
     h2_stream *stream;
-    int n;
+    int n, amax;
     
     /* Try to get rid of streams that occupy workers. Look for safe requests
      * that are repeatable. If none found, fail the connection.
+     *
+     * see: https://github.com/icing/mod_h2/issues/120
+     * Enforcing m->limit_active (which can go as low as 2) was too 
+     * aggressive for media streaming. Players needed to re-open streams/connections
+     * continously as they were reading large files very slowly.
      */
-    n = (m->tasks_active - m->limit_active - (int)h2_ihash_count(m->sredo));
+    amax = m->max_active/2;
+    if (m->limit_active > amax) {
+        amax = m->limit_active; 
+    }
+    n = (m->tasks_active - amax - (int)h2_ihash_count(m->sredo));
+    
     while (n > 0 && (stream = get_latest_repeatable_unsubmitted_stream(m))) {
         h2_task_rst(stream->task, H2_ERR_CANCEL);
         h2_ihash_add(m->sredo, stream);
         --n;
     }
     
-    if ((m->tasks_active - h2_ihash_count(m->sredo)) > m->limit_active) {
+    if ((m->tasks_active - h2_ihash_count(m->sredo)) > amax) {
         h2_stream *stream = get_timed_out_busy_stream(m);
         if (stream) {
             /* Too many busy workers, unable to cancel enough streams