Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 88418632198 for ; Fri, 13 Mar 2009 06:51:57 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 15837-01 for ; Fri, 13 Mar 2009 06:51:45 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id 66638635C74 for ; Fri, 13 Mar 2009 06:51:46 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.3/8.14.3) with ESMTP id n2D9peUX044121 for ; Fri, 13 Mar 2009 06:51:40 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.3/8.14.3/Submit) id n2D9g0a0029516 for pgsql-jdbc@postgresql.org; Fri, 13 Mar 2009 06:42:00 -0300 (ADT) (envelope-from news) From: "Peter" X-Newsgroups: pgsql.interfaces.jdbc References: <49b7bfef$0$1343$834e42db@reader.greatnowhere.com> <49B7CBB6.5020800@opencloud.com> <49b7ced9$0$1343$834e42db@reader.greatnowhere.com> <002201c9a2f9$edd47510$c97d5f30$@com> <491f66a50903120342j67e87c7dob10cfdc23580c8f4@mail.gmail.com> <003001c9a315$a68a9330$f39fb990$@com> Subject: Re: Totally weird behaviour in org.postgresql.Driver Date: Fri, 13 Mar 2009 11:27:44 +0200 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original Lines: 62 Message-ID: <49ba2711$0$1341$834e42db@reader.greatnowhere.com> X-Complaints-To: usenet@greatnowhere.com To: pgsql-jdbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/67 X-Sequence-Number: 19397 > Couple things.... do you really need to synchronize twice in every method > ??? > Have you looked at dbcp or c3po instead of re-inventing the wheel ? > > Can you supply us with a test case which does exhibit the bug ? I'm fairly sure this is JVM/Tomcat bug I'm dealing with here. The test case below was configured to run on every request received by servlet, but only started exhibiting the weird behaviour after few hours of heavy load: import java.sql.*; import java.util.logging.Logger; import org.postgresql.ds.PGSimpleDataSource; public class PGTester { public static void main() { org.postgresql.ds.PGSimpleDataSource _ds=new org.postgresql.ds.PGSimpleDataSource(); _ds.setDatabaseName("mydb"); _ds.setServerName("myhost"); _ds.setPortNumber(5432); for (int i=0; i<20; i++) { Connector con = new Connector(i+1,_ds); new Thread(con, "Conn" ).start(); } } private static class Connector implements Runnable { @SuppressWarnings("unused") private int _num; private PGSimpleDataSource _ds; Connector(int n, PGSimpleDataSource ds) { _num = n; _ds = ds; } public void run() { for (int i=0; i<100; i++) { try { Connection conn = _ds.getConnection("user","pass"); // System.out.println("Connector " + _num + " made connection #" + (i+1)); conn.close(); } catch (Exception e) { Logger.getLogger(this.getClass().getName()).severe(e.getMessage()); } } } } }