pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: David Kerr <dmk@mr-paradox.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Idle in TX / Java process hang's in the vicinity of JDBC
Date: Thu, 29 Jul 2010 16:13:58 -0400 (EDT)
Message-ID: <alpine.BSO.2.00.1007291604460.25915@leary.csoft.net> (raw)
In-Reply-To: <20100729182538.GB49189@mr-paradox.net>
References: <20100729182538.GB49189@mr-paradox.net>



On Thu, 29 Jul 2010, David Kerr wrote:

> We've got an issue where an ETL process just sort of stalled on us last 
> night.
>
> It left a dreaded "Idle in Transaction" in the database. Although 
> fortunatly it didn't appear to have any tables locked.
>
> Stack trace:
> java.net.SocketInputStream.socketRead0(Native Method)
> java.net.SocketInputStream.read(SocketInputStream.java:129)
> org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135)
> org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104)
> org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:186)
> org.postgresql.core.PGStream.Receive(PGStream.java:445)
> org.postgresql.core.PGStream.ReceiveTupleV3(PGStream.java:350)
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1306)
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
>   - locked org.postgresql.core.v3.QueryExecutorImpl@18493c9
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:235)

The stacktrace indicates that Statement.executeQuery was called and the 
JDBC driver started receiving the results from the server.  The driver is 
in the middle of reading a particular row and is waiting for more data 
from the server.  From what you're saying the server thinks it is done, 
but the driver does not, indicating loss of protocol synchronization. 
That's tough to debug after the fact, without a reproducible case or 
network traffic dump.  If you still have this connection stuck in this 
state you could try poking around with a debugger to say what values the 
ReceiveTupleV3 routine has for l_size and already stored in answer.

> We were wondering what the:
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
>   - locked org.postgresql.core.v3.QueryExecutorImpl@18493c9
>
> was refering to.
>

This is just indicating that this routine is synchronized.  This is done 
to prevent multiple threads from trying to communicate with the server 
simultaneously and does not indicate a problem.

Kris Jurka



view thread (7+ messages)  latest in thread

Message-ID: <alpine.BSO.2.00.1007291604460.25915@leary.csoft.net>
Permalink:  ../alpine.BSO.2.00.1007291604460.25915@leary.csoft.net/
Also on:    postgresql.org/message-id/alpine.BSO.2.00.1007291604460.25915@leary.csoft.net

 · 

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: books@ejurka.com, dmk@mr-paradox.net
  Subject: Re: Idle in TX / Java process hang's in the vicinity of JDBC
  In-Reply-To: <alpine.BSO.2.00.1007291604460.25915@leary.csoft.net>
  References: <20100729182538.GB49189@mr-paradox.net> <alpine.BSO.2.00.1007291604460.25915@leary.csoft.net>

* 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