Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2441E17A43 for ; Fri, 6 Mar 2015 16:10:50 +0000 (UTC) Received: (qmail 92515 invoked by uid 500); 6 Mar 2015 16:02:01 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 92462 invoked by uid 500); 6 Mar 2015 16:02:01 -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 92435 invoked by uid 99); 6 Mar 2015 16:02:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2015 16:02:01 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ylavic.dev@gmail.com designates 209.85.213.181 as permitted sender) Received: from [209.85.213.181] (HELO mail-ig0-f181.google.com) (209.85.213.181) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Mar 2015 16:01:55 +0000 Received: by igbhl2 with SMTP id hl2so4864447igb.5 for ; Fri, 06 Mar 2015 08:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=iTnqaLw2PbBffOcIIW20HCz+tNpzXblp5zx437seGRc=; b=MSATmE7T4b7jj0Xi8yHITZWOxNbV9BU13k0gZAv29uM+IfP1/e5RcaKEdHbxlfomUQ PJu+SvWJ8DVBHPksqUeM9mMkRV9exEkvk5hRm7TMfza17P+H4Bu2gT+cabiw1gz2r5ug /Pt9fVvknjAHuDt9lanlr953y2qMEKJgbt3bBBv4x/tEdZBW0aBJS+Dqaz0yziveFmNq KVIn9rAANnAurO1BFakFjXc1by5cSj5hlyGgObOF7LP88krEixYNnORii8vOFuYs0w+6 ZQXn0rfkIgmyoJul7XpbNHOneXXxzaYarpJWoaC2HeD/DpQE7JWFhP4OR5omW+NNHt9F MVkA== MIME-Version: 1.0 X-Received: by 10.50.79.161 with SMTP id k1mr28714116igx.14.1425657695404; Fri, 06 Mar 2015 08:01:35 -0800 (PST) Received: by 10.42.255.7 with HTTP; Fri, 6 Mar 2015 08:01:35 -0800 (PST) In-Reply-To: <54F9C6EF.9000702@apache.org> References: <54F880F2.9060504@apache.org> <54F88B92.1010708@apache.org> <54F9C6EF.9000702@apache.org> Date: Fri, 6 Mar 2015 17:01:35 +0100 Message-ID: Subject: Re: error_time reset in proxy_util.c From: Yann Ylavic To: httpd Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Mar 6, 2015 at 4:25 PM, Ruediger Pluem wrote: > > Index: proxy_util.c > =================================================================== > --- proxy_util.c (revision 1664261) > +++ proxy_util.c (working copy) > @@ -2887,14 +2887,15 @@ > > connected = 1; > } > + if (PROXY_WORKER_IS_USABLE(worker)) { > /* > * Put the entire worker to error state if > * the PROXY_WORKER_IGNORE_ERRORS flag is not set. > * Altrough some connections may be alive > * no further connections to the worker could be made > */ > - if (!connected && PROXY_WORKER_IS_USABLE(worker) && > - !(worker->s->status & PROXY_WORKER_IGNORE_ERRORS)) { > + if (!connected) { > + if (!(worker->s->status & PROXY_WORKER_IGNORE_ERRORS)) { > worker->s->error_time = apr_time_now(); > worker->s->status |= PROXY_WORKER_IN_ERROR; > ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00959) > @@ -2902,6 +2903,7 @@ > APR_TIME_T_FMT "s", > worker->s->hostname, apr_time_sec(worker->s->retry)); > } > + } > else { > if (worker->s->retries) { > /* > @@ -2915,6 +2917,19 @@ > } > return connected ? OK : DECLINED; > } > + else { > + /* > + * The worker is in error likely done by a different thread / process > + * e.g. for a timeout or bad status. We should respect this and should > + * not continue with a connection via this worker even if we got one. > + */ > + if (connected) { > + apr_socket_close(conn->sock ); > + conn->sock = NULL; > + } > + return DECLINED; If the worker is *not a BalancerMember*, couldn't we simply mark the connection as close = 1 here, and continue with it until the end of this request? This is to avoid responding 503 whereas it succeed for this particular request (since this is a race, the worker was put in error state a very little time ago, not at ap_proxy_acquire_connection() time for this request at least). Otherwise, I agree with the move of : + worker->s->error_time = 0; + worker->s->retries = 0; in the correct block. Regards, Yann.