Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9D6E518962 for ; Wed, 9 Mar 2016 15:37:56 +0000 (UTC) Received: (qmail 95739 invoked by uid 500); 9 Mar 2016 15:37:56 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 95679 invoked by uid 500); 9 Mar 2016 15:37:56 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 95669 invoked by uid 99); 9 Mar 2016 15:37:56 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Mar 2016 15:37:56 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A5D801A0490 for ; Wed, 9 Mar 2016 15:37:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.471 X-Spam-Level: * X-Spam-Status: No, score=1.471 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.329] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id L_poZPOBW_4T for ; Wed, 9 Mar 2016 15:37:54 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTP id 877E95F1C2 for ; Wed, 9 Mar 2016 15:37:53 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 97149E0185 for ; Wed, 9 Mar 2016 15:37:52 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id A53AC3A0734 for ; Wed, 9 Mar 2016 15:37:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1734274 - in /httpd/httpd/trunk: CHANGES modules/http2/h2_session.c modules/http2/h2_session.h Date: Wed, 09 Mar 2016 15:37:52 -0000 To: cvs@httpd.apache.org From: icing@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160309153752.A53AC3A0734@svn01-us-west.apache.org> Author: icing Date: Wed Mar 9 15:37:52 2016 New Revision: 1734274 URL: http://svn.apache.org/viewvc?rev=1734274&view=rev Log: mod_http2: more safe approach to async mpm keepalive connection handling Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/http2/h2_session.c httpd/httpd/trunk/modules/http2/h2_session.h Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1734274&r1=1734273&r2=1734274&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Wed Mar 9 15:37:52 2016 @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_http2: give control to async mpm for keepalive timeouts only when + no streams are open and even if only after 1 sec delay. Under load, event + mpm discards connections otherwise too quickly. + *) mod_proxy_http2: rescheduling of requests that have not been processed by the backend when receiving a GOAWAY frame before done. [Stefan Eissign] Modified: httpd/httpd/trunk/modules/http2/h2_session.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_session.c?rev=1734274&r1=1734273&r2=1734274&view=diff ============================================================================== --- httpd/httpd/trunk/modules/http2/h2_session.c (original) +++ httpd/httpd/trunk/modules/http2/h2_session.c Wed Mar 9 15:37:52 2016 @@ -1801,12 +1801,14 @@ static void h2_session_ev_no_io(h2_sessi transit(session, "no io", H2_SESSION_ST_DONE); } else { + apr_time_t now = apr_time_now(); /* When we have no streams, no task event are possible, * switch to blocking reads */ transit(session, "no io", H2_SESSION_ST_IDLE); session->idle_until = (session->requests_received? session->s->keep_alive_timeout : - session->s->timeout) + apr_time_now(); + session->s->timeout) + now; + session->keep_sync_until = now + apr_time_from_sec(1); } } else if (!has_unsubmitted_streams(session) @@ -1817,6 +1819,7 @@ static void h2_session_ev_no_io(h2_sessi * window updates. */ transit(session, "no io", H2_SESSION_ST_IDLE); session->idle_until = apr_time_now() + session->s->timeout; + session->keep_sync_until = session->idle_until; } else { /* Unable to do blocking reads, as we wait on events from @@ -2014,7 +2017,8 @@ apr_status_t h2_session_process(h2_sessi : SERVER_BUSY_READ), "idle"); /* make certain, the client receives everything before we idle */ h2_conn_io_flush(&session->io); - if (async && no_streams && !session->r && session->requests_received) { + if (!session->keep_sync_until + && async && no_streams && !session->r && session->requests_received) { ap_log_cerror( APLOG_MARK, APLOG_TRACE1, status, c, "h2_session(%ld): async idle, nonblock read", session->id); /* We do not return to the async mpm immediately, since under @@ -2067,7 +2071,13 @@ apr_status_t h2_session_process(h2_sessi /* nothing to read */ } else if (APR_STATUS_IS_TIMEUP(status)) { - if (apr_time_now() > session->idle_until) { + apr_time_t now = apr_time_now(); + if (now > session->keep_sync_until) { + /* if we are on an async mpm, now is the time that + * we may dare to pass control to it. */ + session->keep_sync_until = 0; + } + if (now > session->idle_until) { dispatch_event(session, H2_SESSION_EV_CONN_TIMEOUT, 0, "timeout"); } /* continue reading handling */ Modified: httpd/httpd/trunk/modules/http2/h2_session.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_session.h?rev=1734274&r1=1734273&r2=1734274&view=diff ============================================================================== --- httpd/httpd/trunk/modules/http2/h2_session.h (original) +++ httpd/httpd/trunk/modules/http2/h2_session.h Wed Mar 9 15:37:52 2016 @@ -108,6 +108,7 @@ typedef struct h2_session { apr_time_t start_wait; /* Time we started waiting for sth. to happen */ apr_time_t idle_until; /* Time we shut down due to sheer boredom */ + apr_time_t keep_sync_until; /* Time we sync wait until passing to async mpm */ apr_pool_t *pool; /* pool to use in session handling */ apr_bucket_brigade *bbtmp; /* brigade for keeping temporary data */