pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <kgrittn@ymail.com>
To: Dave Cramer <pg@fastcrypt.com>
To: dhaval jaiswal <dhavallj@hotmail.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: Hung thread
Date: Tue, 28 Oct 2014 07:28:16 -0700
Message-ID: <1414506496.58956.YahooMailNeo@web122301.mail.ne1.yahoo.com> (raw)
In-Reply-To: <CADK3HHJVvgFAXniBL55Yq832cgpkKefppGLqtRGGSNT5=O9zyA@mail.gmail.com>
References: <BLU172-W5146020A537205E97A1984DF920@phx.gbl>
	<BLU172-W50BDC3B02FFCEF0C571E15DF9F0@phx.gbl>
	<CADK3HHJVvgFAXniBL55Yq832cgpkKefppGLqtRGGSNT5=O9zyA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

Dave Cramer <pg@fastcrypt.com> wrote:
> On 28 October 2014 07:34, dhaval jaiswal <dhavallj@hotmail.com> 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



view thread (10+ messages)  latest in thread

Message-ID: <1414506496.58956.YahooMailNeo@web122301.mail.ne1.yahoo.com>
Permalink:  ../1414506496.58956.YahooMailNeo@web122301.mail.ne1.yahoo.com/
Also on:    postgresql.org/message-id/1414506496.58956.YahooMailNeo@web122301.mail.ne1.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: kgrittn@ymail.com, pg@fastcrypt.com, dhavallj@hotmail.com
  Subject: Re: Hung thread
  In-Reply-To: <1414506496.58956.YahooMailNeo@web122301.mail.ne1.yahoo.com>
  References: <BLU172-W5146020A537205E97A1984DF920@phx.gbl> <BLU172-W50BDC3B02FFCEF0C571E15DF9F0@phx.gbl> <CADK3HHJVvgFAXniBL55Yq832cgpkKefppGLqtRGGSNT5=O9zyA@mail.gmail.com> <1414506496.58956.YahooMailNeo@web122301.mail.ne1.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox