Further to my previous post, on looking a bit further I discovered in this post:
http://n2.nabble.com/database-connections-GN-2-4-1-td4578290.html
The following snippet explaining the "reconnectTime" parameter in config.xml:
"reconnectTime: when a free (unlocked) database connection is found
(during an iteration of the database connection pool), if its been
connected longer than the reconnectTime, it is closed and then
re-connected: default: 0 (never reconnect) - note though that if the
database connection is found to be closed then reconnectTime is set to 1
and the connection is re-connected."
So I changed my Postgres resource config to be:
<resource enabled="true">
<name>main-db</name>
<provider>jeeves.resources.dbms.DbmsPool</provider>
<config>
<user>username</user>
<password>password</password>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://servername:5432/geonetwork</url>
<poolSize>10</poolSize>
<reconnectTime>900</reconnectTime>
</config>
</resource>
This has led to a definite increase in app stability. Previously it would repeatably hang overnight (for reasons explained in my previous post) such that GN would need a reload from the container every morning when I wanted to use it again. Since I made this change it has been working reliably (no reloads needed) since Wednesday evening here. A bit early to say whether this has fixed the problem of stale database connections, and I agree with the other poster that connection pooling config belongs in the container rather than app config files.
David Herbert
British Antarctic Survey.