Return-Path: X-Original-To: apmail-directory-api-archive@minotaur.apache.org Delivered-To: apmail-directory-api-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5BF4C17EED for ; Wed, 15 Oct 2014 22:55:56 +0000 (UTC) Received: (qmail 38659 invoked by uid 500); 15 Oct 2014 22:55:56 -0000 Delivered-To: apmail-directory-api-archive@directory.apache.org Received: (qmail 38597 invoked by uid 500); 15 Oct 2014 22:55:56 -0000 Mailing-List: contact api-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: api@directory.apache.org Delivered-To: mailing list api@directory.apache.org Delivered-To: moderator for api@directory.apache.org Received: (qmail 19603 invoked by uid 99); 15 Oct 2014 22:49:27 -0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of zapletal-martin@email.cz designates 77.75.76.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=email.cz; s=beta; t=1413413339; bh=Zt4h6f/LOG4qerRPsBxLU6iwmYpBEScGP8rqwoh7wfM=; h=Received:From:To:Subject:Date:Message-Id:Mime-Version:X-Mailer: Content-Type; b=aLnFAw5N0YRVjEFFaE76XTpSA+P5KXlVBzTfvQd1aSBoSXKcfUQVVbhtmlas8mBTs PJ65qJX4qDDaCIoLpSV2cqjAu4gmJ2Frtws6B6hQd3wu2XS5+AIoBkLU3jMSVRtNus tPv6dmrnN6J2G26ANRiK3F/WMdVnMBOvJXY4WFV4= From: To: Subject: Fwd: Ldap persistent connection pool issues Date: Thu, 16 Oct 2014 00:48:57 +0200 (CEST) Message-Id: Mime-Version: 1.0 (szn-mime-2.0.0) X-Mailer: szn-ebox-4.4.232 Content-Type: multipart/alternative; boundary="=_797f809b31f0b91b642e02b1=040ab751-1fd7-50c1-8836-a2330000dd25_=" X-Virus-Checked: Checked by ClamAV on apache.org --=_797f809b31f0b91b642e02b1=040ab751-1fd7-50c1-8836-a2330000dd25_= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello,=0A= =0A= =0A= =0A= we are still having issues with the below.=0A= =0A= =0A= =0A= =0A= Any help on how to properly handle connection pool, what exceptions to loo= k =0A= for and how to react to their occurence etc. to guarantee long life of the= =0A= connection would be very appreciated.=0A= =0A= =0A= =0A= =0A= Thank you=0A= =0A= =0A= =0A= ---------- P=C5=AFvodn=C3=AD zpr=C3=A1va ----------=0A= Od: zapletal-martin@email.cz=0A= Komu: users@directory.apache.org=0A= Datum: 13. 10. 2014 15:45:36=0A= P=C5=99edm=C4=9Bt: Ldap persistent connection pool issues=0A= =0A= "=0A= Hello,=0A= =0A= =0A= =0A= we are building a service using Apache Directory LDAP API. It should be a = =0A= long running service so it should manage the LDAP connection properly to = =0A= avoid disconnects or other issues after being up for a long time.=0A= =0A= =0A= =0A= =0A= The code we are using looks roughly like this=0A= =0A= =0A= =0A= =0A= Initialization:=0A= =0A= =0A= =0A= =0A= =0A= =C2=A0 =C2=A0 LdapConnectionConfig=C2=A0config =3D new LdapConnectionConfi= g()=0A= =0A= =C2=A0 =C2=A0 config.setLdapHost(...)=0A= =0A= =C2=A0 =C2=A0 config.setLdapPort(...)=0A= =0A= =C2=A0 =C2=A0 config.setName(...)=0A= =0A= =C2=A0 =C2=A0 config.setCredentials(...)=0A= =0A= =0A= =0A= =0A= =C2=A0 =C2=A0 connectionPool =3D new LdapConnectionPool(new =0A= PoolableLdapConnectionFactory(config))=0A= =0A= =C2=A0 =C2=A0 connectionPool.setTestOnBorrow(true)=0A= =0A= =C2=A0 =C2=A0 connectionPool.setTestOnReturn(true)=0A= =0A= =0A= =0A= =0A= =0A= On each request=0A= =0A= =0A= =0A= =0A= =0A= =C2=A0 =C2=A0 =C2=A0 LdapConnection connection =3D connectionPool.getConne= ction()=0A= =0A= =C2=A0 =C2=A0 =C2=A0 connection.setTimeOut(...)=0A= =0A= =C2=A0 =C2=A0 =C2=A0 ... //Do search/add/delete/modify using the connectio= n=0A= =0A= =C2=A0 =C2=A0 =C2=A0 connectionPool.releaseConnection(connection)=0A= =0A= =0A= =0A= =0A= =0A= We are currently trying to troubleshoot the service. Everything works fine= , =0A= but after some time the service logs error similar to the below and stops = =0A= working. Restart of the service fixes the issue. Therefore we suspect the = =0A= long running nature of the service and we believe we may be using the = =0A= connection pool incorrectly (e.g. not releasing the connection correctly)= =0A= =0A= =0A= =0A= =0A= =0A= ERROR[ForkJoinPool-2-worker-3] PoolableLdapConnectionFactory - unable to = =0A= unbind connection: Cannot connect on the server, the connection is invalid= =0A= =0A= =0A= =0A= =0A= Unfortunately it is difficult to find documentation or examples of proper = =0A= usage of connection pool. Are we using it right or are we missing some ste= ps=0A= (e.g. bind, unbind, connect, reconnect after some time, ..?). Are there an= y =0A= examples or documentation I could read to understand how to use the pool?= =0A= =0A= =0A= =0A= =0A= Any help appreciated,=0A= =0A= =0A= =0A= =0A= Thanks=0A= =0A= Martin=0A= =0A= =0A= "=0A= --=_797f809b31f0b91b642e02b1=040ab751-1fd7-50c1-8836-a2330000dd25_=--