X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 87FDF9FB227 for ; Tue, 11 Jul 2006 14:07:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 89323-03 for ; Tue, 11 Jul 2006 14:07:45 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id B58A39FB221 for ; Tue, 11 Jul 2006 14:07:45 -0300 (ADT) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 11 Jul 2006 10:07:43 -0700 Subject: Re: executeQuery Locked From: Mark Lewis To: Lucas Sousa Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Tue, 11 Jul 2006 10:07:43 -0700 Message-Id: <1152637663.30994.380.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/38 X-Sequence-Number: 15464 It could possibly be a bug in the driver, but much more likely it's just the server waiting on some normal condition. What exactly is the query in question? Are you running with autocommit on or off? -- Mark Lewis On Tue, 2006-07-11 at 13:29 -0300, Lucas Sousa wrote: > 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? > >