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

JDBC connection pool timeout, container-managed connection pool

SA-45067

Summary



After a connection loss on the VPN connection from the Cloud instance to the on-premise custom database, the user recognizes a problem with the connection to that database. In particular, an attempt to require a database connection from the container connection pool timed out. The Pega log reports exceptions from the method ConnectionManagerImpl.getSemaphoreForConnectionPool().


Error Messages



com.pega.pegarules.pub.database.DatabaseException: Unable to obtain connection for database "..."; timeout exceeded while waiting for a connection: code: <none> SQLState: <none> Message: <none>
From: (...)
at com.pega.pegarules.data.internal.access.ConnectionManagerImpl.getSemaphoreForConnectionPool(ConnectionManagerImpl.java:1722)
at com.pega.pegarules.data.internal.access.ConnectionManagerImpl.getConnectionFromDataSourceIdentity(ConnectionManagerImpl.java:979)
at com.pega.pegarules.data.internal.access.ConnectionManagerImpl.getConnection(ConnectionManagerImpl.java:1216)
at com.pega.pegarules.data.internal.access.ConnectionManagerImpl.getConnection(ConnectionManagerImpl.java:1156)
...


Steps to Reproduce

  1. Create a Database definition rule for an external database:
    For "How to connect", select "use JDBC URL" and set "Max Connections" to a low value.
  2. Change "How to connect" on that Database rule from "use JDBC URL" to "use JDBC Connection Pool".
  3. Use that database in an agent that runs quite often and keeps the connection for a long period of time before returning it.
  4. Disconnect the database server while the agent is running and then reconnect.
  5. You might need to repeat these steps for some time before the error scenario is created.


Root Cause



A defect in Pegasystems’ code or rules, specifically the Database definition rule

A clear indication for the problem is the involvement of the method ConnectionManagerImpl.getSemaphoreForConnectionPool(). This method should not be called when a container-managed connection pool is used.

The "How to connect" options "use JDBC URL" and "use JDBC Connection Pool" have different additional attributes. Unfortunately, the attributes for one option are not invalidated when the other option is activated. Therefore, the code in ConnectionManagerImpl sees these artifacts and responds to them. In this case, the value for Max Connections is not zero (as it should be for a container-managed connection pool). The methods that are related to a PRPC internal connection pool are called.

Resolution



Until the Database rule defect is resolved in a future release, perform the following local-change:
  1. Change "How to connect" on the Database rule to "use JDBC URL".
  2. Set "Max Connection" to zero.
  3. Switch back to "use JDBC Connection Pool".
  4. Save the Database rule.
  5. Restart all nodes in your Pega environment.

Published October 10, 2017 - Updated October 8, 2020

Was this useful?

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.

Did you find this content helpful?

Want to help us improve this content?

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