[Geoserver-devel] Connections in PostGISDataStore in ConnectionPool are dead in the morning

Hello!

A problem:
I use several modules of GeoServer 1.5.x generation (data-1.5.2.jar,
platform-1.5.2.jar) and their dependencies from GeoTools in web application
running under Tomcat. My idea is to reuse DataStore/FeatureType
configuration stuff (like catalog.xml) from GeoServer and get DataStore
instances directly from business logic of my webapp to operate over
features. So, GeoServer configuration modules are built-in to my webapp.
There is a client mapping component (based on Mapbender application
framework) that communicates with my webapp that performs feature operations
through PostGISDataStore in PostGIS. When I come to the office in the
morning (I do not shutdown my testing Tomcat server) seems all connections
are dead in old good ConnectionPool of the PostGISDataStore instance, I
suppose because of long timeout.

With our OracleDataStore implementation this was not problem because
ConnectionPool.ConnectionPoolCleaner worked fine for OracleConnection. After
long timeout first request to ConnectionPool to get available connection is
failed, but not valid Connection instance is removed by
ConnectionPoolCleaner during this request and the next request creates
totally new Connection instance and put it to availableConnections list and
it starts to work. I have not encountered these problems with GeoServer
itself (when request PostGIS after long timeout). We use postgis_1.3.1.jar
and postgresql-8.2-505.jdbc3.jar with PostGIS 8.2.

Looking to the code of ConnectionPool. ConnectionPoolCleaner I see possible
reasons:
1) "PostGIS connection".isValid() returns always true
2) Who does call ConnectionPoolCleaner.disable() during the night ?:slight_smile:

Any hints?

Vitali Diatchkov.

=========================================

Caused by: java.net.SocketException: Connection reset
  at java.net.SocketInputStream.read(Unknown Source)
  at
org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInput
Stream.java:135)

..................................
..................................
..................................

at
org.geotools.data.postgis.PostgisDataStore.getTypeNames(PostgisDataStore.jav
a:357)

Vitali Diatchkov ha scritto:

Hello!

A problem:
I use several modules of GeoServer 1.5.x generation (data-1.5.2.jar,
platform-1.5.2.jar) and their dependencies from GeoTools in web application
running under Tomcat. My idea is to reuse DataStore/FeatureType
configuration stuff (like catalog.xml) from GeoServer and get DataStore
instances directly from business logic of my webapp to operate over
features.

...

Any hints?

The 1.5.x GeoServer series is at end of life, Geotools 2.3.x is unmantained as well (you won't see a new release of neither one).

GeoServer 1.6.0 on the contrary uses gt2 2.4.0, where we killed
those connection pool classes and replaced them with DBCP, which
allows you to setup a solid limit on the max connection number
and also allows for checking if a connection is still alive
before using it.

I'd suggest to upgrade to 1.6.0, alternatively you can try to
fix the problem in the gt2 2.3.x connection pool series.

Cheers
Andrea