pgjdbc-ng icon indicating copy to clipboard operation
pgjdbc-ng copied to clipboard

Out of memory while running pgjdbc test suite

Open vlsi opened this issue 9 years ago • 3 comments
trafficstars

It looks like pgjdbc-ng does not release memory on connection.close or something like that.

pgjdbc's test suite with -Xmx512m fails with OOM.

See https://github.com/pgjdbc/pgjdbc/pull/501 (the idea is to use mvn -P pgjdbc-ng to use pgjdbc-ng driver for pgjdbc test suite)

dominator_tree pgconnectionimpl

vlsi avatar Jan 29 '16 22:01 vlsi

Thanks for your report !

jesperpedersen avatar Feb 02 '16 18:02 jesperpedersen

Unless things have changed, the pgjdbc test suite relies upon the fact that the connection's finalize closes the connection; which in turn closes all the statements, result sets, etc.

Many, if not most, of the "ng" unit tests were taken directly from pgjbdc with the only major changes being that I tried to ensure that all the Connection, Statement & ResultSet objects were explicitly closed. There are still some lingering ones because we get the odd warning as we run the unit tests sometimes.

The JDBC standard requires a close and thus "ng" doesn't have a finalize that closes the connection. It instead has a "Housekeeper" that works to try and close things you forgot (it also yells at you when you it finds something). It is implemented using a daemon thread and PhantomReferences.

I would guess the large number of opened objects is piling up as it works its way through the unit tests and the daemon thread isn't able to keep up.

kdubb avatar Feb 02 '16 19:02 kdubb

+1

craftmaster2190 avatar Mar 16 '20 06:03 craftmaster2190