Wednesday, November 18, 2015

Workaround for ConnectionPool closed error at API Manager Gateway

Hi in a clustered setup if there is a continuous high load , following issue can occur at the gateway node.

An error occurred while submitting resources for indexing {org.wso2.carbon.registry.indexing.ResourceSubmitter}
org.wso2.carbon.registry.core.exceptions.RegistryException: Failed to commit transaction.
    at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.commitTransaction(JDBCTransactionManager.java:164)
    at org.wso2.carbon.registry.core.jdbc.dao.JDBCLogsDAO.commitTransaction(JDBCLogsDAO.java:330)
    at org.wso2.carbon.registry.core.jdbc.dao.JDBCLogsDAO.getLogList(JDBCLogsDAO.java:304)
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.getLogs(EmbeddedRegistry.java:2332)
    at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.getLogs(CacheBackedRegistry.java:402)
    at org.wso2.carbon.registry.core.session.UserRegistry.getLogsInternal(UserRegistry.java:1813)
    at org.wso2.carbon.registry.core.session.UserRegistry.access$3600(UserRegistry.java:60)
    at org.wso2.carbon.registry.core.session.UserRegistry$37.run(UserRegistry.java:1784)
    at org.wso2.carbon.registry.core.session.UserRegistry$37.run(UserRegistry.java:1781)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.wso2.carbon.registry.core.session.UserRegistry.getLogs(UserRegistry.java:1781)
    at org.wso2.carbon.registry.indexing.ResourceSubmitter.submitResource(ResourceSubmitter.java:127)
    at org.wso2.carbon.registry.indexing.ResourceSubmitter.run(ResourceSubmitter.java:83)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: PooledConnection has already been closed.



Here we do not need registry indexing to happen at the gateway node. Therefore we could disable the indexing at the gateway node to overcome this issue. However, in APIM 1.8.0 these index disabling configs are not available. So what you could do is to delay indexing at the gateway node. For this go to /conf/registry.xml file(of the gateway node) and under <indexConfiguration> , increase below interval value to few hours.

<indexingFrequencyInSeconds></indexingFrequencyInSeconds>

No comments:

Post a Comment