Skip to main content
This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Tomcat does not revalidate connections

SA-30878

Summary



Tomcat does not revalidate connections before providing a connection to Pega 7 platform.


Error Messages



[MSG][Unable to retrive autocommit value due to following error This connection has been closed.][STACK][org.postgresql.util.PSQLException: This connection has been closed.
 at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:843
 at org.postgresql.jdbc2.AbstractJdbc2Connection.getAutoCommit(AbstractJdbc2Connection.java:804)
 at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)



Steps to Reproduce



Run a Stress test or leave an active system idle for a period of time.


Root Cause



A defect or configuration issue in the operating environment.
The Connection pool  elements in the context.xml are insufficient to guarantee that the connection provided to Pega is valid. An explicit set of connection pool parameters must be provided instead.



Resolution



Make the following change to the operating environment:

Add the below attributes in the Resource element for the jdbc/PegaRULES connection,

    testOnBorrow="true"
    testOnConnect="true"
    testOnReturn="true"
    testWhileIdle="true"
    validationQuery="select 1"

This causes the validation query to be executed at specific points in time, as follows:

testOnBorrow - If true, connections are validated before they are returned from the pool. If the validation fails, the connection is destroyed and a new connection is retrieved from the pool (and validated).

testOnConnect - The indication of whether objects will be validated when a connection is created. If an object fails to validate, SQLException occurs.

testOnReturn -  If true, connections are validated before they are returned to the pool. If the validation fails, the connection is destroyed instead of being returned to the pool.

testWhileIdle - If true, connections will be validated by the idle connection evictor (if any). If the validation fails, the connection is destroyed and removed from the pool.

The validation query above is valid for Postgres.

For long running queries that are disconnected, change the following:     removeAbandoned="true"
    removeAbandonedTimeout="some large number greater than the longest expected query"


Additionally, set  the following,

    removeAbandoned="false"

The below setting logs abandoned connections,

    logAbandoned="true"


 
Suggest Edit

Published November 29, 2018 - Updated October 8, 2020

Did you find this article helpful?
Did you find this content helpful? Yes No

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us