[Geoserver-users] Geoserver leaves idle connections to Postgresql

Hi all,

I’m using GeoServer 2.7.7, with JVM version 1.7.0_65 (OpenJDK 64-Bit Server VM). I’m also using Postgresql server version 9.2.0.

The problem is that when I open the Layer Preview and I visualize a layer with OpenLayers I see new open connection to Postgresql DB that stay in IDLE status.
The problem is the same when I upload into geoserver new layers.

I also set up a JNDI connection pool but the problem still remains.

Does anyone knows why?

Thank you for your help.
Best regards,

Matteo.

On Tue, Feb 2, 2016 at 10:04 AM, matteo rivola <mrganesh86@anonymised.com> wrote:

Hi all,

I'm using GeoServer 2.7.7, with JVM version 1.7.0_65 (OpenJDK 64-Bit
Server VM). I'm also using Postgresql server version 9.2.0.

The problem is that when I open the Layer Preview and I visualize a layer
with OpenLayers I see new open connection to Postgresql DB that stay in
IDLE status.
The problem is the same when I upload into geoserver new layers.

I also set up a JNDI connection pool but the problem still remains.

Does anyone knows why?

Because that's what a connection pool is designed to do, keep connections
open so
that the next request does not have to pay the price of creating a new one
every time.

https://en.wikipedia.org/wiki/Connection_pool

You can tune the parameters of the pool to keep the connections alive for
less time,
of course that might have a negative effect on performance

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

On 06/02/16 02:07, Andrea Aime wrote:

You can tune the parameters of the pool to keep the connections alive for
less time,
of course that might have a negative effect on performance

Matteo,

why do you want database connections shut down?

This example from app-schema has been configured to shut down all connections after ten minutes to protect against firewalls that sever connections, but you may be able to use a similar configuration if you have a need to do the same:
http://docs.geoserver.org/latest/en/user/data/app-schema/data-stores.html#jndi

Here is the main JNDI page:
http://docs.geoserver.org/latest/en/user/tutorials/tomcat-jndi/tomcat-jndi.html

Kind regards,

--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/&gt;
New Zealand

Dear all,
I want to thank you for your prompt reply.

Probably I didn’t explayn well my problem.

I know that Geoserver open a connection pool with the DB, so the connection has to stay open. Also I have configured JNDI in the same way explained in the Geoserver docs.

The problem is that in my system the connections in idle grow up untill the DB can not handle.

I set up the parameter “maxIdle” in the server.xml file but it doesn’t work.

Thank you for your patience and cooperation.

Best regards,
Matteo.

···

2016-02-05 20:37 GMT+01:00 Ben Caradoc-Davies <ben@anonymised.com>:

On 06/02/16 02:07, Andrea Aime wrote:

You can tune the parameters of the pool to keep the connections alive for
less time,
of course that might have a negative effect on performance

Matteo,

why do you want database connections shut down?

This example from app-schema has been configured to shut down all connections after ten minutes to protect against firewalls that sever connections, but you may be able to use a similar configuration if you have a need to do the same:
http://docs.geoserver.org/latest/en/user/data/app-schema/data-stores.html#jndi

Here is the main JNDI page:
http://docs.geoserver.org/latest/en/user/tutorials/tomcat-jndi/tomcat-jndi.html

Kind regards,


Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/>
New Zealand