SQL timeout ApplyRetentionPolicies

Hi, this is a follow up to:

We upgraded from 2021.3.12132 to 2022.3.10723 this morning and we are still experiencing problems when the apply retention policies job is running.


Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Current transactions: Transaction ‘ApplyRetentionPoliciesTaskController|ServerTasks-1149407-0732b0b9-40e2-4936-89a6-7ba372fbd652|T91’ Open with 201 commands started at 2022-11-18T13:00:07 (794.83 seconds ago) 2022-11-18T13:00:07 SELECT * FROM Release_WithDeploymentProcess WHERE Release_SpaceId=@spaceId 2022-11-18T13:02:19 SELECT CAST(CHECKSUM_AGG(CAST(HASHBYTES(‘MD5’, CAST([DataVersion] AS varbinary)) AS int)) AS binary(8)) AS [Latest], COUNT(*) AS [Count], ‘Project’ AS [TableName], [SpaceId] AS [PartitionId] FROM [dbo].[Project] WHERE (((([SpaceId] in (‘Spaces-1’))))) AND (([SpaceId] IN (‘Spaces-1’))) GROUP BY [SpaceId]

and more but the text was too long to paste here…

Good afternoon @jonny.andersson,

Thank you for contacting Octopus Support and sorry to hear you are seeing issues with the retention policy task timing out.

I noticed you put a ticket in for this over on our zendesk platform so, to save duplication we will continue to troubleshoot through email if that is ok.

Once we get that fixed for you I will post up the troubleshooting process here in case another customer runs into this issue.

Kind Regards,

Sounds good, thanks.

1 Like


We are also experiencing this issue, would like to know when a solution is found.



Hi Paul,

I have a link for the GitHub issue that you can follow for updates. When resolved and released, we will update the issue with the Octopus version containing the fix.

Best regards,