-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlException Transaction (Process ID 66) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. #193
Comments
Kind ping |
We should be automatically retrying deadlocks, so I wonder if those retries are being exhausted. Unfortunately, it's hard to fix these without having a reliable repro that can be used for testing. Are you comfortable making changes directly to your database? One thing you can try is changing the deadlock priority of the For example, you'd need to do an ALTER PROCEDURE [dt].[QuerySingleOrchestration]
@InstanceID varchar(100),
@ExecutionID varchar(50) = NULL,
@FetchInput bit = 1,
@FetchOutput bit = 1
AS
BEGIN
SET DEADLOCK_PRIORITY HIGH
DECLARE @TaskHub varchar(50) = dt.CurrentTaskHub()
SELECT TOP 1
I.[InstanceID],
I.[ExecutionID],
I.[Name],
I.[Version],
I.[CreatedTime],
I.[LastUpdatedTime],
I.[CompletedTime],
I.[RuntimeStatus],
I.[ParentInstanceID],
(SELECT TOP 1 [Text] FROM Payloads P WHERE
P.[TaskHub] = @TaskHub AND
P.[InstanceID] = I.[InstanceID] AND
P.[PayloadID] = I.[CustomStatusPayloadID]) AS [CustomStatusText],
CASE WHEN @FetchInput = 1 THEN (SELECT TOP 1 [Text] FROM Payloads P WHERE
P.[TaskHub] = @TaskHub AND
P.[InstanceID] = I.[InstanceID] AND
P.[PayloadID] = I.[InputPayloadID]) ELSE NULL END AS [InputText],
CASE WHEN @FetchOutput = 1 THEN (SELECT TOP 1 [Text] FROM Payloads P WHERE
P.[TaskHub] = @TaskHub AND
P.[InstanceID] = I.[InstanceID] AND
P.[PayloadID] = I.[OutputPayloadID]) ELSE NULL END AS [OutputText],
I.[TraceContext]
FROM Instances I
WHERE
I.[TaskHub] = @TaskHub AND
I.[InstanceID] = @InstanceID AND
(@ExecutionID IS NULL OR @ExecutionID = I.ExecutionID)
END If you're comfortable doing so, can you try and see if that helps? It doesn't fix the deadlock, but it makes it less likely to impact the If you're able to find a way to reproduce this consistently, I could use that reproducer to find a more reliable/permanent fix. |
Hi @cgillum |
Hi all
We are using durable functions in a stand alone process (not azure functions) in kubernetes cluster.
Microsoft.DurableTask.SqlServer.AzureFunctions nuget version 1.1.1
Sometimes when calling
ReadEntityStateAsync
we get an exception:Transaction (Process ID 63) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
It happens once every few thousands of orchestrations.
The full call stack:
The text was updated successfully, but these errors were encountered: