search cancel

Oracle OTK database was not being purged


Article ID: 242363


Updated On:


CA API Gateway


This happened in the past and we want to understand why this happened.

Layer7 version = 10.0 CR04

OTK version = 4.3.1 CR02

We are using the default OTK scheduled task

We usually have around 500k tokens in the database when the purge is working properly. Recently, we had a problem with the "OTK Database Maintenance - token" task and upon research we found out that there was more than 32 million tokens in the database. It seems like the purge stop functioning properly around 1 month before we saw the impact.


Release : 10.0

Component :


The scheduled task uses JDBC query assertion to delete records of all expired tokens, there is a bug in the scheduled task where the number of deletes becomes excessive to the point where it's unable to complete in one cycle when this occurs no tokens get deleted causing the table to continuously increase 



In version OTK 4.5 the schedule task has been modified to purge in blocks/limits instead of ALL at once.

Recommend upgrading to the latest OTK 


OR If unable to upgrade the attached service (OTK Maintenance) can be configured as a task and will operate similar to the newer task



There are objects that need to be created (Policy/service, then the task)


Create Policy - Policy type: Policy-Backed Service Operation Policy Fragment

Policy Tag: com.l7tech.objectmodel.polback,BackgroundTask

Import the XML 

Task -> Global Settings -> Manager Scheduled Tasks


Job Name

Policy:  Select the new Policy Created 

Configure times/recurring as needed 



1667486673504__OTK_Service.xml get_app