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 447D09FA5DC for ; Wed, 9 Aug 2006 10:47:10 -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 85856-08 for ; Wed, 9 Aug 2006 10:46:58 -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 B88109FA385 for ; Wed, 9 Aug 2006 10:46:58 -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; 09 Aug 2006 06:46:56 -0700 Subject: Re: SQL query never ends From: Mark Lewis To: James Im Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Wed, 09 Aug 2006 06:46:55 -0700 Message-Id: <1155131215.1634.1131.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-Spam-Status: No, hits=0.58 tagged_above=0 required=5 tests=AWL, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200608/51 X-Sequence-Number: 15578 This sort of behavior often indicates some kind of unsafe concurrent usage of the JDBC Connection. Is this running in a multi-threaded environment? If so, are there measures in place to ensure that only one thread uses the connection at a time? It would also be useful if you could do a thread dump while it's hanging and send a stack trace of the affected thread. -- Mark On Wed, 2006-08-09 at 10:21 +0000, James Im wrote: > I'm experimenting a random problem on my PC. Sometimes a sql query > executed with Statement never returns. The code is blocked at a line > like this one: > > rs = stmt.executeQuery("select true"); > > The query is not important: it fails with any type of query, at random, > even with the one above. > > I never get an exception. > > Now the logs. I've enable logging at the database level and I have set > "statement_timeout = 3000". I have searched for the query in > postgresql's log but I cannot find the query which is blocking in my > java code so I guess that it means that the query never reached postgresql. > > I've enabled jdbc logging with "loglevel=2" and this is what I get: > > simple execute, > handler=org.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler@996cca, > maxRows=0, fetchSize=0, flags=17 > FE=> Parse(stmt=null,query="i've remove the select query",oids={}) > FE=> Bind(stmt=null,portal=null) > FE=> Describe(portal=null) > FE=> Execute(portal=null,limit=0) > FE=> Sync > > .. and nothing else. No "<=BE ..." follow the " FE=> Sync" log entry. > > > I've also tried to put "stmt.setQueryTimeout(3);" but it doesn't seem to > do anything. > > I'm using postgresql 8.1.4 on Windows 2000 Pro SP4 and the driver is > "8.1-407 JDBC 3". I'm also using java 1.5.0_06-b05. > > > I guess that there is a bug in the driver. If I'm wrong, please tell me > how to solve it. If I'm right, could you try to fix it? > > _________________________________________________________________ > Log p MSN Messenger direkte p nettet: http://webmessenger.msn.com > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly