After enabling settings to delete obsolete inventory in the Obsolete inventory section of the Inventory tab on the System Settings page, the batch process that runs to delete the inventory may fail with a timeout if there is a large volume of data to delete. When this occurs, obsolete inventory data will not be removed as expected.
This issue occurs because deleting a large volume of inventory data can take longer than 1 hour, which is the timeout allowed by the batch process that performs this operation.
Executing the following query against the compliance database (for FlexNet Manager Suite systems) will show details of the last 10 executions of the process to delete obsolete inventory:
SELECTTOP 10 Output, StartTime, FinishTime, Progress, ReturnCode
WHERE BatchProcessTypeID = 46 /* IMTenantObsoleteInventoryMaintenance */
ORDERBY StartTime DESC
When this issue occurs, Output message values returned by the above query will show the following:
CleanObsoleteInventoryData failed. Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Flexera One IT Asset Management customers should contact Flexera Support for assistance if this issue occurs.
FlexNet Manager Suite customers can execute the following SQL script against the inventory database using a tool like SQL Management Studio. Change the number of days on the first line based on how long you plan to keep obsolete inventory data for.
DECLARE @ObsoleteInventoryPeriodInDays INT = 30
DECLARE @staleDate DATETIME = DATEADD(day, -@ObsoleteInventoryPeriodInDays, DATEDIFF(Day, 0, GetDate()))
DECLARE @BatchSize INT = 10
CREATETABLE #Computer (ComputerID BIGINT)
WHILE 1 = 1
SELECTTOP (@BatchSize) c.ComputerID
FROM dbo.Computer cINNERJOIN dbo.InventoryReport ir ONc.ComputerID = ir.ComputerID
WHERE ir.HWDate < @staleDate
BEGINTRANSACTIONIFEXISTS(SELECT 1 from #Computer )
IF @@ROWCOUNT < @BatchSize BREAKENDDROPTABLE #Computer
This script may run for a long time, but will continue to make progress as it continues to run. It will delete a small number of computers at a time.
If this script terminates with a timeout, deadlock or other other error of a transient nature, keep repeating executions of the script until it no longer times out: the script will continue to make progress deleting records, even if transient errors occur from time to time.
Once this script has complete once to delete a potentially large volume of data, the batch process to delete newly obsoleted data will then typically be able to complete without a timeout condition continuing to occur.