Tomcat does not revalidate connections
SummaryTomcat does not revalidate connections before providing a connection to Pega 7 platform.
Error Messages[MSG][Unable to retriveautocommit value due to following error This connection has been closed.][STACK][org.postgresql.util.PSQLException: This connection has been closed.
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
Steps to ReproduceRun a Stress test or leave an active system idle for a period of time.
Root CauseA 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.
ResolutionMake 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:
removeAbandonedTimeout="some large number greater than the longest expected query"Additionally, set the following, removeAbandoned="false"The below setting logs abandoned connections, logAbandoned="true"
Published November 29, 2018 - Updated October 8, 2020