pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lucas Sousa <lucas75@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: executeQuery Locked
Date: Tue, 11 Jul 2006 13:29:50 -0300
Message-ID: <cccdaefb0607110929w6117e9d3w6904c7fd73fe5399@mail.gmail.com> (raw)

People, I am having a very anoying problem:

I am issuing this:

        boolean result = false;
        Statement stm = null;
        ResultSet rs = null;
        try
        {
            stm = conn.createStatement( ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY );
            stm.setQueryTimeout( timeout );
            rs = stm.executeQuery( sql );  <- the proccess is stopped here
for more than half an hour
            result = rs.next();
        }
        finally
        {
            DbUtils.closeQuietly( rs );
            DbUtils.closeQuietly( stm );
        }
        return result;


sql is a simple select that returns one row (if I take it and send to pgsql
it works fine)
timeout = 120 (seconds) / I am using a DBCP pool / I use one or more
connection per thread (I get it inside the method and release inside the
method)

If I get my debbuger and interrupt the thread I see it stopped in some point
of execution of stm.executeQuery (it seems to be waitng a response from the
postgres server) but at the same time I go to the server and does not find
the query itself runnning.

It seems to me that for some (weird) reason, the query timeout is bein
achieved without throwing any error or the postgresql driver detecting that.


This is some know issue?
It is possible that the backend is cancelling the connection by timeout and
the driver does not notice and continues waiting for it?

the driver I am using is postgresql-8.2dev-503.jdbc3.jar (and it happens the
same thing with the 8.0 driver)

and the stack trace of one of such locked proccess:

Thread [zzzzzzz:12] (Suspended)
    SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int)
line: not available [native method]
    SocketInputStream.read(byte[], int, int) line: not available
    BufferedInputStream.fill() line: not available
    BufferedInputStream.read() line: not available
    PGStream.ReceiveChar() line: 256
    QueryExecutorImpl.processResults(ResultHandler, int) line: 1164
    QueryExecutorImpl.execute(Query, ParameterList, ResultHandler, int, int,
int) line: 190
    Jdbc3Statement(AbstractJdbc2Statement).execute(Query, ParameterList,
int) line: 452
    Jdbc3Statement(AbstractJdbc2Statement).executeWithFlags(String, int)
line: 340
    Jdbc3Statement(AbstractJdbc2Statement).executeQuery(String) line: 239
    DelegatingStatement.executeQuery(String) line: 205
    xxxx() line: 580 <- this is the line in the code I sent.
    xxxx(int) line: 504
    xxxx(int) line: 523
    xxxx() line: 156
    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
    NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not
available
    Method.invoke(Object, Object...) line: not available
    ScheduleTaskRunner.run() line: 139
    Thread.run() line: not available

Has anyone seen this kind of situation before?

view thread (6+ messages)  latest in thread

Message-ID: <cccdaefb0607110929w6117e9d3w6904c7fd73fe5399@mail.gmail.com>
Permalink:  ../cccdaefb0607110929w6117e9d3w6904c7fd73fe5399@mail.gmail.com/
Also on:    postgresql.org/message-id/cccdaefb0607110929w6117e9d3w6904c7fd73fe5399@mail.gmail.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: lucas75@gmail.com
  Subject: Re: executeQuery Locked
  In-Reply-To: <cccdaefb0607110929w6117e9d3w6904c7fd73fe5399@mail.gmail.com>
  References: <cccdaefb0607110929w6117e9d3w6904c7fd73fe5399@mail.gmail.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