Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-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 EB3E6173BA for ; Wed, 7 Jan 2015 10:08:50 +0000 (UTC) Received: (qmail 23510 invoked by uid 500); 7 Jan 2015 10:08:49 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 23457 invoked by uid 500); 7 Jan 2015 10:08:49 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 23446 invoked by uid 99); 7 Jan 2015 10:08:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jan 2015 10:08:47 +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 (nike.apache.org: domain of elecharny@gmail.com designates 74.125.82.47 as permitted sender) Received: from [74.125.82.47] (HELO mail-wg0-f47.google.com) (74.125.82.47) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jan 2015 10:08:22 +0000 Received: by mail-wg0-f47.google.com with SMTP id n12so861644wgh.6 for ; Wed, 07 Jan 2015 02:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=ohUddE9cJ1CvgPbH7ArN2enVpSuPKXsln4ZWJwOne40=; b=tWLaBnq9zrOJL2QX+1t2DDK25IY8h5qUjeAZfk3VcNFM+P1WNb7ipPyK2n86h4dAAN fbaoAdMCPUKbX0nZBW1wCrFty/4rnUuTYJVNYxdWMEEGlQHRESpwLU6SCXfhh6Uo4wFu PHG54/gD/SCf6gq4y6zPS8v5A5gK8UCZjfWf16HKFoXFZ8CvrFagKan8jy0qXRLm1/Cd cpYtEXyU8Co4CjpF5btJlZMowsCPfJ8QvuPF5YmEWG9dT/n1BcZqIWHzpLYL40e5V221 lLiJiz1QI+abxevYIjdWHzEOMGMw7ySAwB5D59yH+1OGuWUCyOFOFIHpJdxKbVsXJ1vU 4K0Q== X-Received: by 10.180.78.202 with SMTP id d10mr47188516wix.82.1420625256283; Wed, 07 Jan 2015 02:07:36 -0800 (PST) Received: from [192.168.1.10] (AMontsouris-651-1-97-92.w82-123.abo.wanadoo.fr. [82.123.116.92]) by mx.google.com with ESMTPSA id qg11sm17214307wic.17.2015.01.07.02.07.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Jan 2015 02:07:35 -0800 (PST) Message-ID: <54AD0566.7070102@gmail.com> Date: Wed, 07 Jan 2015 11:07:34 +0100 From: =?UTF-8?B?RW1tYW51ZWwgTMOpY2hhcm55?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Apache Directory Developers List Subject: [LDAP API] Connection pool issue Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi guys, in the past 5 days, I fought with some serious issues with the LDAP Connection pool. What I saw is that at some point, the pool was stopping to work. The pb was only visible when you had many threads, as it was associated with connections being released and closed because the number of idle connections was above the maximum allowed by the pool (you can configure the pool so that it creates connections on demand, but delete them when the number o finactive connection is above a given number. This is a way to mitigate the pool growth). The pb was that we were not checking the result of the connection.close() operation : it returns a CloseFuture that has to be used to wait for the terminaison, otheriwse the connection might be in a transient state for a bit of time, and under heavy load, that will really be a pb. I will commit the change, create a JIRA and most certainly cut a new release for this. I have created three tests that are in @Ignore mode, because they are quite long to run (around 2 minutes each). Note that in order to have one of those tests to pass, you will have to tune your system - specifically the TIME_WAIT delay - to let the test create new sockets, as it creates hundred of thousands of them, when you can only have 64k-1024 sockets created with n where X is an ephemeral port (on Mac, the number is even lower : 16K, per http://www.iana.org/assignments/service-names-port-numbers/service-names-= port-numbers.xhtml). Settung a delay of 500ms or even 1s should work, but please, don't do that on a normal server or client.