Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 38867 invoked from network); 22 Dec 2009 08:47:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Dec 2009 08:47:51 -0000 Received: (qmail 16856 invoked by uid 500); 22 Dec 2009 08:47:50 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 16740 invoked by uid 500); 22 Dec 2009 08:47:48 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 16728 invoked by uid 99); 22 Dec 2009 08:47:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Dec 2009 08:47:48 +0000 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [69.147.107.20] (HELO mrout1-b.corp.re1.yahoo.com) (69.147.107.20) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Dec 2009 08:47:40 +0000 Received: from kingleast.grenoble.corp.yahoo.com (kingleast.grenoble.corp.yahoo.com [10.76.44.49]) by mrout1-b.corp.re1.yahoo.com (8.13.8/8.13.8/y.out) with ESMTP id nBM8l2lC013785 for ; Tue, 22 Dec 2009 00:47:02 -0800 (PST) Message-ID: <4B308785.5040004@free.fr> Date: Tue, 22 Dec 2009 09:47:01 +0100 From: Cyrille Roy User-Agent: Thunderbird 2.0.0.22 (X11/20090609) MIME-Version: 1.0 To: Commons Users List Subject: Re: Deadlock in DBCP and Pooling References: <4B2CB2BD.9070800@apache.org> In-Reply-To: <4B2CB2BD.9070800@apache.org> Content-Type: multipart/alternative; boundary="------------090008030209050409080808" X-Virus-Checked: Checked by ClamAV on apache.org --------------090008030209050409080808 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, agree with Mark. If you did not setup maxActive, default value is 8, see http://commons.apache.org/dbcp/configuration.html you can set it to -1, but I strongly discourage this because you will not see connection leak and you will damage both java server and database. you should consider: - doing a thread dump (use sudo kill -3 on Linux or Ctrl+Break on Windows) - use netstat -ap | grep ... to check number of established cnx and who is using them - setting maxWait to 1000 for example so you get an exception after 1000 ms if the pool is exhausted. For it will help for debug purpose at least to check weither you have contention (you will get few exceptions) or deadlock (you will get non stopping exceptions) Note that there is a contention issue on previous pool implementation. Cyrille Mark Thomas wrote: > On 19/12/2009 00:02, Pawan Singh wrote: > >> I am getting a deadlock in the following place very occasionally. My code is >> set up exactly as the examples suggest on the DBCP site. >> >> The code seems to be deadlocked at: >> >> GenericObjectPool.borrowObject() line:1104 <--- this code is in >> WHEN_EXHAUSTED_BLOCK and is waiting on latch.wait(). >> PoolingDataSource.getConnection() line: 96 >> >> My set up does not initialize the max or min connections at all with the >> understanding that the pool will allocate new connections as needed. Is the >> deadlock caused by the fact that someone did not return the connection to >> the pool and there is a max limit on it? How do I find how many connections >> are in the pool and who is using them? >> >> One last piece of information - I am using DBCP and Pool in a J2SE app. >> > > Do you mean deadlocked or blocked. There is a difference. A thread dump > would help considerably here. > > What versions are dbcp and pool are you using? > > Mark > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > --------------090008030209050409080808--