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 6D5A0200C45 for ; Tue, 28 Mar 2017 23:05:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6BDF7160B89; Tue, 28 Mar 2017 21:05:48 +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 B094D160B6B for ; Tue, 28 Mar 2017 23:05:47 +0200 (CEST) Received: (qmail 46730 invoked by uid 500); 28 Mar 2017 21:05:41 -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 46720 invoked by uid 99); 28 Mar 2017 21:05:41 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Mar 2017 21:05:41 +0000 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 3A7DD3A04C1 for ; Tue, 28 Mar 2017 21:05:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1789220 - in /httpd/httpd/trunk: CHANGES server/listen.c Date: Tue, 28 Mar 2017 21:05:41 -0000 To: cvs@httpd.apache.org From: ylavic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170328210541.3A7DD3A04C1@svn01-us-west.apache.org> archived-at: Tue, 28 Mar 2017 21:05:48 -0000 Author: ylavic Date: Tue Mar 28 21:05:41 2017 New Revision: 1789220 URL: http://svn.apache.org/viewvc?rev=1789220&view=rev Log: core: Disallow multiple Listen on the same IP:port when listener buckets are configured (ListenCoresBucketsRatio > 0), consistently with the single bucket case (default), thus fixing the leak of the corresponding socket descriptors on graceful restart. Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/server/listen.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1789220&r1=1789219&r2=1789220&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Tue Mar 28 21:05:41 2017 @@ -1,6 +1,11 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) core: Disallow multiple Listen on the same IP:port when listener buckets + are configured (ListenCoresBucketsRatio > 0), consistently with the single + bucket case (default), thus avoiding the leak of the corresponding socket + descriptors on graceful restart. [Yann Ylavic] + *) mod_http2: input buffering and dynamic flow windows for increased throughput. [Stefan Eissing] Modified: httpd/httpd/trunk/server/listen.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/listen.c?rev=1789220&r1=1789219&r2=1789220&view=diff ============================================================================== --- httpd/httpd/trunk/server/listen.c (original) +++ httpd/httpd/trunk/server/listen.c Tue Mar 28 21:05:41 2017 @@ -404,18 +404,14 @@ static const char *set_systemd_listener( #endif /* HAVE_SYSTEMD */ -static const char *alloc_listener(process_rec *process, char *addr, - apr_port_t port, const char* proto, - void *slave) +static int find_listeners(ap_listen_rec **from, ap_listen_rec **to, + const char *addr, apr_port_t port) { - ap_listen_rec **walk, *last; - apr_status_t status; - apr_sockaddr_t *sa; - int found_listener = 0; + int found = 0; + + while (*from) { + apr_sockaddr_t *sa = (*from)->bind_addr; - /* see if we've got an old listener for this address:port */ - for (walk = &old_listeners; *walk;) { - sa = (*walk)->bind_addr; /* Some listeners are not real so they will not have a bind_addr. */ if (sa) { ap_listen_rec *new; @@ -428,19 +424,39 @@ static const char *alloc_listener(proces if (port == oldport && ((!addr && !sa->hostname) || ((addr && sa->hostname) && !strcmp(sa->hostname, addr)))) { - new = *walk; - *walk = new->next; - new->next = ap_listeners; - ap_listeners = new; - found_listener = 1; + found = 1; + if (!to) { + break; + } + new = *from; + *from = new->next; + new->next = *to; + *to = new; continue; } } - walk = &(*walk)->next; + from = &(*from)->next; + } + + return found; +} + +static const char *alloc_listener(process_rec *process, const char *addr, + apr_port_t port, const char* proto, + void *slave) +{ + ap_listen_rec *last; + apr_status_t status; + apr_sockaddr_t *sa; + + /* see if we've got a listener for this address:port, which is an error */ + if (find_listeners(&ap_listeners, NULL, addr, port)) { + return "Cannot define multiple Listeners on the same IP:port"; } - if (found_listener) { + /* see if we've got an old listener for this address:port */ + if (find_listeners(&old_listeners, &ap_listeners, addr, port)) { if (ap_listeners->slave != slave) { return "Cannot define a slave on the same IP:port as a Listener"; }