deegree / deegree3

Official deegree repository providing geospatial core libraries, data access and advanced OGC web service implementations
https://www.deegree.org
GNU Lesser General Public License v2.1
146 stars 99 forks source link

SQLFeatureStore - Postgresql - Dropped connections #599

Open jarped opened 9 years ago

jarped commented 9 years ago

On occasion I get this error:

Error performing query by operator filter: An I/O error occured while sending to the backend.

I've seen it mentioned here: http://www.postgresql.org/message-id/001701c53a90$cf879cc0$6600a8c0@kermit

and here: http://stackoverflow.com/questions/17285340/postgresql-exception-an-i-o-error-occured-while-sending-to-the-backend

It seems this error needs to be handled and a new connection made when it occurs.

I guess it stems from https://github.com/deegree/deegree3/blob/c091dded9cd9dc496cdae7d9868cef70bb0bac27/deegree-datastores/deegree-featurestores/deegree-featurestore-sql/src/main/java/org/deegree/feature/persistence/sql/SQLFeatureStore.java#L745

copierrj commented 8 years ago

It looks like the connection provider is providing a broken connection to the feature store. This is most likely caused by a connection being terminated while not in use (i.e. while the connection resides unused in the pool). While the connection is not used this is not detected but subsequent usage of it results in an exception.

The only way to handle this case more gracefully (= invisible to the user) would be to test a connection (preferably by the connection provider) before trying to use it.

Unfortunately this error is hard to trigger at will, do you have a reliable method of reproducing this error?

jarped commented 8 years ago

I traced this error to a loadbalancer that terminated unused connections. I have since routed traffic around the loadbalancer, which fixes the problem. Other than that, I don't know how to reproduce the error.