Major problem in PostgreSQL JDBC driver that will cause OutOfMemoryErrors

Поиск
Список
Период
Сортировка
От Gerald Gutierrez
Тема Major problem in PostgreSQL JDBC driver that will cause OutOfMemoryErrors
Дата
Msg-id E14n6SG-000B3S-00@mail2.uniserve.com
обсуждение исходный текст
Список pgsql-bugs
The PostgreSQL JDBC ( bundled with 7.1 RC3 at least) driver makes use of Java's ThreadLocal class in the
.../jdbc2/PreparedStatement.javaclass to hold onto DateFormat classes used during the setTImestamp() and  
setDate() calls. Sun's J2SE 1.3 has a major bug in the implementation of ThreadLocal in which progressive use leaks
moreand more memory. 

This means that as more PreparedStatements are used, more and more memory is leaked, and at a high rate. Eventually,
theJava VM runs out of memory and any applications running within it will crash and burn. 

Our stress tests indicate that our application running on top of the Orion application server will crash with an hour
aftertaking up all available memory when using this driver. 

A solution is to NOT use ThreadLocal in the PreparedStatement class. This solution works because ThreadLocal is used as
an"optimization" to avoid allocating the DateFormat classes multiple times. On our site, we  
patched the RC3 JDBC driver to not use the ThreadLocal object and everything is runnning fine with no perceivable
performanceloss. 

Sun's bug report is here:


http://developer.java.sun.com/developer/bugParade/bugs/4414045.html



Gerald.

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

Предыдущее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: When I install postgresql using rpm it is ok. When I compile the fonts and execute the initdb hapen a Error: unknown type 'ame'.
Следующее
От: "Rainer Mager"
Дата:
Сообщение: RE: Problem with 7.0.3 dump -> 7.1b4 restore