Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 1A9269FB90A for ; Sat, 4 Aug 2007 23:58:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 83654-06-2 for ; Sat, 4 Aug 2007 23:57:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id EF5099FB91F for ; Sat, 4 Aug 2007 23:57:51 -0300 (ADT) Received: (qmail 6755 invoked by uid 1112); 5 Aug 2007 02:57:50 -0000 Date: Sat, 4 Aug 2007 22:57:50 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: "L. Rahyen" cc: pgsql-jdbc@postgresql.org Subject: Re: Strange crashes in JDBC code in multithreaded application. In-Reply-To: <200708050216.12872.research@science.su> Message-ID: References: <200708050216.12872.research@science.su> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/38 X-Sequence-Number: 17351 On Sun, 5 Aug 2007, L. Rahyen wrote: > Exception in thread "Thread-108" java.lang.NullPointerException > at > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:182) > at ... > at java.lang.Thread.run(libgcj.so.70) > This area of code reads: 175 if (parameters == null) 176 parameters = SimpleQuery.NO_PARAMETERS; 177 178 boolean describeOnly = (QUERY_DESCRIBE_ONLY & flags) != 0; 179 180 // Check parameters are all set.. 181 if (!describeOnly) 182 ((V3ParameterList)parameters).checkAllParametersSet(); So it's complaining that parameters is null, but the code on line 175 should take care of that case. I note that you're using GCJ, does this problem occur when using a Sun JVM? > 1) This is a bug in JDBC. Is JDBC thread-safe? Is it supposed to be > thread-safe by design? Obviously if not then initializing conn > every time will be inefficient and I need to write a separate server to > execute PSQL queries because I want to connect only once to the DB. JDBC is thread safe. While PG's driver can only execute one query at a time, it should block, not die like this. Kris Jurka