Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xj7l4-0000wD-4g for pgsql-jdbc@arkaria.postgresql.org; Tue, 28 Oct 2014 14:28:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xj7l2-0001vr-Ti for pgsql-jdbc@arkaria.postgresql.org; Tue, 28 Oct 2014 14:28:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Xj7l2-0001vl-6w for pgsql-jdbc@postgresql.org; Tue, 28 Oct 2014 14:28:24 +0000 Received: from nm8-vm2.bullet.mail.ne1.yahoo.com ([98.138.90.156]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Xj7kv-0005VQ-MC for pgsql-jdbc@postgresql.org; Tue, 28 Oct 2014 14:28:22 +0000 Received: from [98.138.100.102] by nm8.bullet.mail.ne1.yahoo.com with NNFMP; 28 Oct 2014 14:28:16 -0000 Received: from [98.138.88.234] by tm101.bullet.mail.ne1.yahoo.com with NNFMP; 28 Oct 2014 14:28:16 -0000 Received: from [127.0.0.1] by omp1034.mail.ne1.yahoo.com with NNFMP; 28 Oct 2014 14:28:16 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 391640.35316.bm@omp1034.mail.ne1.yahoo.com Received: (qmail 61143 invoked by uid 60001); 28 Oct 2014 14:28:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1414506496; bh=mbcUHUqwjw/cZ/NLALr+no/4sbB4yShqdyYSEFfwJ7k=; h=References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=ARyxitDbi660vBHMv4bOoPHTMOlEWDnNtHXasJ28KQMvjJyXdZ0KTjd0usGKY9h/LzoldBy21zy1rtJr2ureBCR26InTPNXMLTsHh1I/KxmeQa3LLE5eem8ndcUD2oQpJAeST4KeEufWPOKsjwle4GPqYem19jTmiSEMKJ/qaC4= X-YMail-OSG: ECaFAR4VM1lqbI39mPzs_PPCR09.nc29lgJ1o8fncJhQDcW 7KVWRdXwMrkfm3WGDLIzZUfHst6OU.V5Qa3ZNfxPbQBxKXxKbgsBU.n9IgmF AynlmNa3YDbhIHK6nt680MMS9nycOdRwm.m7JEDmAD_Gc4UNZtjV5lnU4ThC 65xWSZ3RAHiDmqm8K8pi3fd2_2goVbNQqJLOOXmC1KZBfZRxERLoJV0okVaP nIWhcDnngSmCQFnctFtN29pjkbLX0pM91mH7iRIwB3fVWbxKIwwGfqMx3kS6 Z0zgVugcsJDh0rzHzByB5B_PhJQL2M94e_BpmrQkICz6Ryw8sFO2K63AxNXL mPvHD_nHNc5d21.Loeuyf9xR9VY9.gEuEWtQQrCFr5VWEbAyiZKEvKwC_TPt LzBU.A381SqhwnjWaqZ_lulk9.TtYO4sO7IT2QuHL7VT2EaoEdN_rqvhky7a XA5ZbebRs11lm2stdFsx.7fkZuC2TEmG7kY8n.IFW97XqFjrMDCAzrvc1Dul fc7MMWRwhwMO9.sJiPlO.xjbOQlbISLoay1.S5VZ4VuwTJ8ubRXj1EYBwXhK BXHrSo0AATcaiIitEkSE- Received: from [24.178.25.147] by web122301.mail.ne1.yahoo.com via HTTP; Tue, 28 Oct 2014 07:28:16 PDT X-Rocket-MIMEInfo: 002.001, RGF2ZSBDcmFtZXIgPHBnQGZhc3RjcnlwdC5jb20.IHdyb3RlOgo.IE9uIDI4IE9jdG9iZXIgMjAxNCAwNzozNCwgZGhhdmFsIGphaXN3YWwgPGRoYXZhbGxqQGhvdG1haWwuY29tPiB3cm90ZToKCj4.IGphdmEubGFuZy5UaHJlYWQuU3RhdGU6IFJVTk5BQkxFCj4.ICAgICAgICBhdCBqYXZhLm5ldC5Tb2NrZXRJbnB1dFN0cmVhbS5zb2NrZXRSZWFkMChOYXRpdmUgTWV0aG9kKQo.PiAgICAgICAgYXQgamF2YS5uZXQuU29ja2V0SW5wdXRTdHJlYW0ucmVhZChTb2NrZXRJbnB1dFN0cmVhbS5qYXZhOjEyOSkKPj4BMAEBAQE- X-Mailer: YahooMailWebService/0.8.203.733 References: Message-ID: <1414506496.58956.YahooMailNeo@web122301.mail.ne1.yahoo.com> Date: Tue, 28 Oct 2014 07:28:16 -0700 From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: Hung thread To: Dave Cramer , dhaval jaiswal Cc: "pgsql-jdbc@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Dave Cramer wrote: > On 28 October 2014 07:34, dhaval jaiswal wrote: >> java.lang.Thread.State: RUNNABLE >> at java.net.SocketInputStream.socketRead0(Native Method) >> at java.net.SocketInputStream.read(SocketInputStream.java:129) >> at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145) >> at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:114) >> at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) >> at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:274) >> at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1660) >> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) >> - locked <0x00002aaaf6282d00> (a org.postgresql.core.v3.QueryExecutorImpl) >> at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) >> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374) >> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254) >> at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) >> at org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:84) >> at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96) >> at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) >> at com.eos.hotels.viahotel.manager.ViaHotelDatabaseManager.getConnection(ViaHotelDatabaseManager.java:74) [ snip ] > Given the little bit of information available my guess would be > that since this is using dbcp, and the connections are never really > closed. The stack trace shows that the getConnection() method of dbcp is trying to re-use a connection in the pool, and is first testing the connection by invoking our JDBC driver's executeQuery() method. > I believe once a connection is made we are always listening > on the socket. I don't follow that; it is listening for the response to a query. What thread would be "always listening", anyway? The driver is not multi-threaded. > However I will say I haven't really spent much time on this. Either > way we would need much more information in order to be able to help > you. It would be interesting to know what query dbcp is using to test whether the connection is still alive. Also, if the client port can be discovered, looking for it in the pg_stat_activity view would be interesting. I can think of one halfway plausible explanation, though. A firewall between the machine running dbcp and the database server might be blocking traffic after some idle timeout, possibly resulting in a hang like this when the pooler eventually tries to use the connection again. You might want to try configuring TCP timeouts on both the client and the server. It wouldn't hurt to closely review the network path between the machines. Logging connections and disconnections and closely reviewing the server logs could provide insights. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc