Re: NullPointerException while closing connection with

Поиск
Список
Период
Сортировка
От Aaron Mulder
Тема Re: NullPointerException while closing connection with
Дата
Msg-id Pine.LNX.4.44.0305111040170.10749-100000@www.princetongames.org
обсуждение исходный текст
Ответ на NullPointerException while closing connection with connectionpool  (Jani Virta <jani.virta.news@kortis.to>)
Список pgsql-jdbc
Jani,
    Can you put together a small test program that demonstrates the
problem?  Like, configures a pool and then launches 20 threads that all
try to execute the code below, and if you run it for a little bit you get
the problem?  It's hard to debug thread problems without a good example.

Thanks,
    Aaron

On Thu, 8 May 2003, Jani Virta wrote:
> I have multiple threads writing log to db and once a while I get this
> error  message, with a result of one connection freezing to "idle in
> transaction" state.
>
> java.lang.NullPointerException
>         at
> org.postgresql.jdbc2.optional.PooledConnectionImpl$ConnectionHandler.invoke(PooledConnectionImpl.java:230)
>         at $Proxy0.close(Unknown Source)
>         at config.logadd(config.java:154)
>
> driver is latest (7.3 jdbc3 build 109)
> jvm is sun j2re 1.4.1_02  with redhat 9
> code I'm using for writing logs. Line 154 is conn.close();
>
> static public void logadd(String s) {
>         try {
>             Connection conn = datasource.getConnection();
>             String insert="INSERT INTO log (time, entry) VALUES ((SELECT
> CURRENT_TIMESTAMP), '"+s+"')";
>             Statement logstmt = conn.createStatement();
>             logstmt.executeUpdate(insert);
>             logstmt.close();
>             conn.close();
>         } catch (SQLException e) {
>             System.out.println("Tried to write : "+s+"\nlog write
> failed. exception "+e);
>         }
> }
>
> Any thoughts? Looks like a threading problem since this happens until I
> have max number of connections open and all but one connection in "idle
> in transaction" state.
>
> -jani
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "anon permutation"
Дата:
Сообщение: Strange column naming problem
Следующее
От: "Cris"
Дата:
Сообщение: Buffers and query's