Comments (4)
![image](https://private-user-images.githubusercontent.com/6139491/271836110-1946b2ac-1381-435c-9213-7e58484146bb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTEzNTE2NDQsIm5iZiI6MTcxMTM1MTM0NCwicGF0aCI6Ii82MTM5NDkxLzI3MTgzNjExMC0xOTQ2YjJhYy0xMzgxLTQzNWMtOTIxMy03ZTU4NDg0MTQ2YmIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMjVUMDcyMjI0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NTQxYzYxZjllM2Q2NTQ0ZDVkMTBjYTUyNzRiOGQ2ZThlNGY1YmI5NGUxNDRjNjM1MTVmMTUwMWQyNTBmM2RhMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.DhiYLFVFFUeM1_x-0LHqHe5G1xuTbj6mDKtCBtSX2co)
from durabletask-mssql.
Kind ping
@cgillum
from durabletask-mssql.
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 dt.QuerySingleOrchestration
stored procedure, adding a SET DEADLOCK_PRIORITY HIGH
to the top of the procedure to make it more likely to survive deadlocks.
For example, you'd need to do an ALTER PROCEDURE
statement similar to the following:
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 ReadEntityStateAsync
. Instead, the other deadlock participant will get rolled back. Assuming the other deadlock participant is less important or is a background task that can be automatically retried, this could improve the overall availability of your app. However, it could also just move the problem elsewhere.
If you're able to find a way to reproduce this consistently, I could use that reproducer to find a more reliable/permanent fix.
from durabletask-mssql.
Hi @cgillum
I manually applied your change to the stored procedure and it seems to help. After the fix, I wasn't able to reproduce the error.
Is there a way to apply it programmatically when the process starts?
Currently, we are letting the SDK create the DB with the flag task.StorageProvider["createDatabaseIfNotExists"] = true;
from durabletask-mssql.
Related Issues (20)
- Prevent termination of pods with long-running functions using KEDA HOT 2
- Incorrect Calculation of GetRecommendedScale due to UTC/Local Time formats in tables HOT 4
- SqlUtils doesn't support suspending HOT 4
- Azure SQL transient error HOT 3
- Lost Events HOT 10
- await operator on non-OrchestrationContext tasks leaves Instance in perpetual running state HOT 2
- Instance ID should be 256 char HOT 2
- Support to host the taskhub as part of a vanila asp.net core webapp HOT 5
- App fails to start up when upgrading from 1.0.0 to 1.2.0 schema
- Automate database schema upgrade testing HOT 1
- Connection String question HOT 12
- NewEvents stuck due to InvalidCastException HOT 6
- MaxActiveOrchestrations set to 1 does not work, mutliple Orchestrations are running HOT 1
- SqlOrchestrationService is not visible when referencing Microsoft.Azure.Functions.Worker.Extensions.DurableTask.SqlServer HOT 1
- Update Microsoft.Data.SqlClient and related dependencies
- Durable Entity creates NullReferenceException with Microsoft.Azure.Functions.Worker.Extensions.DurableTask.SqlServer HOT 5
- Recommendations on storing large payloads HOT 4
- NullReferenceException in SqlORchestrationService HOT 7
- Orchestration execution retry due to OperationCanceledException? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from durabletask-mssql.