Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 29515 invoked from network); 30 Sep 2008 15:02:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Sep 2008 15:02:46 -0000 Received: (qmail 17127 invoked by uid 500); 30 Sep 2008 15:02:40 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 16946 invoked by uid 500); 30 Sep 2008 15:02:39 -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 16935 invoked by uid 99); 30 Sep 2008 15:02:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 08:02:39 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of martin.wingert@gmail.com designates 209.85.217.12 as permitted sender) Received: from [209.85.217.12] (HELO mail-gx0-f12.google.com) (209.85.217.12) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 15:01:39 +0000 Received: by gxk5 with SMTP id 5so12088730gxk.18 for ; Tue, 30 Sep 2008 08:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=fPcu5A9cvPg3Z4Rq0oRpnFkJIbMdZm6FWhSr58fjbgw=; b=xlnnfrj6eIoPRPLovhSEhWqcawFMiEq1o1lVHCYefud6ZEJjzFIU8lPQF3PjYMLH3p C2ypjFcVkccTTy6PUCmAY2ebLI7J0Jc2sdvFtZlkYU/CEPBhOy8S3EDwS6KiqKN+eFDc 9AayLxQM6TOmhSXh0UUTOTu/euu5mlYoSLQrQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=LZebbIq/MRgSeQQ27VwpcY/irVto4UMbqZ+bt58trm44w13kMGPkWuAN8Jh93mVyHZ J8bNXAD2gURWuxzD+EvedWQiA33wb3Y0l2SK3XONksa5l3vb+9ddPD+SN/qug9w4WQtP ymWvJYIfeDXlU40Oc114zABYl1HzI1jEnUdRw= Received: by 10.142.172.12 with SMTP id u12mr2834319wfe.180.1222786872759; Tue, 30 Sep 2008 08:01:12 -0700 (PDT) Received: by 10.142.214.14 with HTTP; Tue, 30 Sep 2008 08:01:12 -0700 (PDT) Message-ID: Date: Tue, 30 Sep 2008 17:01:12 +0200 From: "Martin Wingert" To: user@commons.apache.org Subject: [DBCP] connections not properly closed MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org I'm running dbcp 1.2.2 and mysql-connector-java-5.1.6 on a test system. Just found that the system after running a couple of hours got an exception in the log files when trying to create a new database connection: java.net.SocketException: Too many open files Checked the list of open files (lsof) and got a long list: java 10659 admin 6u sock 0,4 1555102 can't identify protocol The PID is the jvm running our system. Found that the MySQL setting wait_timeout (that closes idle connections after the configured time) was set to 60 seconds by accident. So it seems that when MySQL closes an idle connection somehow the JDBC connection in the database pool isn't closed properly leaving the file descriptor open (this is a test system so there are many idle connections). This is the code I use to setup my pool: GenericObjectPool m_generic_objectpool = new GenericObjectPool(); m_generic_objectpool.setMaxActive(connection_timeout); m_generic_objectpool.setMaxWait(max_wait); m_generic_objectpool.setTestOnBorrow(true); m_generic_objectpool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK); ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(full_url,conProp); AbandonedConfig ab_conf = new AbandonedConfig(); ab_conf.setRemoveAbandonedTimeout(m_dbpool_abandoned_timeout); ab_conf.setRemoveAbandoned(m_dbpool_close_abandoned); String validation_query = new String("SELECT 1"); new PoolableConnectionFactory(connectionFactory,m_generic_objectpool,null,validation_query,false,true,ab_conf); PoolingDataSource data_source = new PoolingDataSource(m_generic_objectpool); Thankful for any help BR // Martin --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org