Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C74432007D0 for ; Tue, 10 May 2016 14:38:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C5FA2160877; Tue, 10 May 2016 12:38:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 163DC1607AA for ; Tue, 10 May 2016 14:38:03 +0200 (CEST) Received: (qmail 79516 invoked by uid 500); 10 May 2016 12:37:58 -0000 Mailing-List: contact dev-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 dev@httpd.apache.org Received: (qmail 79506 invoked by uid 99); 10 May 2016 12:37:58 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2016 12:37:58 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 9B2ADC15F1 for ; Tue, 10 May 2016 12:37:57 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.3 X-Spam-Level: X-Spam-Status: No, score=0.3 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 6uuwFhCNPLPD for ; Tue, 10 May 2016 12:37:54 +0000 (UTC) Received: from lookie3.hostorama.com (lookie3.hostorama.com [80.74.148.208]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 8B8445F36D for ; Tue, 10 May 2016 12:37:53 +0000 (UTC) Received: from lookie.metanet.ch (localhost [127.0.0.1]) by lookie3.hostorama.com (Postfix) with ESMTPSA id 532E2AE0107 for ; Tue, 10 May 2016 14:37:47 +0200 (CEST) Received: from nat13.ergon.ch (nat13.ergon.ch [87.239.215.13]) by webmail.michael-kaufmann.ch (Horde Framework) with HTTP; Tue, 10 May 2016 14:37:47 +0200 Date: Tue, 10 May 2016 14:37:47 +0200 Message-ID: <20160510143747.Horde.23bRyFNVPC38ozmanQ6X8j4@webmail.michael-kaufmann.ch> From: Michael Kaufmann To: dev@httpd.apache.org Subject: Re: Detecting client aborts and stream resets References: <20160503163109.Horde.dDuX6tl_vMFkpJE75Qne6Q0@webmail.michael-kaufmann.ch> <20160504224457.Horde.q1fPqaQz_n-MFDXjfchHxG9@webmail.michael-kaufmann.ch> In-Reply-To: User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline archived-at: Tue, 10 May 2016 12:38:05 -0000 Zitat von William A Rowe Jr : > On Wed, May 4, 2016 at 3:44 PM, Michael Kaufmann > wrote: > >> William is right, this is not a good idea. The ->aborted flag should serve >>> this purpose of telling anyone interested that this connection is not >>> longer delivering. I will make a github release soon where that is working >>> and you can test. >>> >>> >> Thank you Stefan! It is now working for stream resets, but it's not yet >> working if the client closes the whole TCP connection. >> > > As expected... this is why I pointed out in my first reply that you don't > want a single-protocol solution to this puzzle. Of course I'd also prefer a general solution. I have created a patch for mod_http2: With the patch, it sets c->aborted on the master connection and also on the "dummy" connections (streams) when the client closes the TCP connection. @Stefan: It would be great if you could check this code and add it to mod_http2 :-) Index: modules/http2/h2_mplx.c =================================================================== --- modules/http2/h2_mplx.c (revision 1743146) +++ modules/http2/h2_mplx.c (working copy) @@ -488,6 +488,15 @@ return 1; } +static int task_abort_connection(void *ctx, void *val) +{ + h2_task *task = val; + if (task->c) { + task->c->aborted = 1; + } + return 1; +} + apr_status_t h2_mplx_release_and_join(h2_mplx *m, apr_thread_cond_t *wait) { apr_status_t status; @@ -537,6 +546,8 @@ * and workers *should* return in a timely fashion. */ for (i = 0; m->workers_busy > 0; ++i) { + h2_ihash_iter(m->tasks, task_abort_connection, m); + m->join_wait = wait; status = apr_thread_cond_timedwait(wait, m->lock, apr_time_from_sec(wait_secs)); @@ -591,6 +602,7 @@ AP_DEBUG_ASSERT(m); if (!m->aborted && enter_mutex(m, &acquired) == APR_SUCCESS) { m->aborted = 1; + m->c->aborted = 1; h2_ngn_shed_abort(m->ngn_shed); leave_mutex(m, acquired); } > See my later reply about detecting connection tear-down, patches welcome. Sounds good! If someone sends a patch, I will help to test it.