Skip to content

Commit 67f2f8b

Browse files
committed
Finish docs update for concurrency
1 parent 0587b5a commit 67f2f8b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed
465 KB
Loading

docs/queue-concurrency.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export const subtask = task({
180180

181181
## Waits and concurrency
182182

183-
With our (task checkpoint system)[/how-it-works#the-checkpoint-resume-system], a parent task can trigger and wait for a subtask to complete. The way this system interacts with the concurrency system is a little complicated but important to understand. There are two main scenarios that we handle slightly differently:
183+
With our [task checkpoint system](/how-it-works#the-checkpoint-resume-system), a parent task can trigger and wait for a subtask to complete. The way this system interacts with the concurrency system is a little complicated but important to understand. There are two main scenarios that we handle slightly differently:
184184

185185
- When a parent task waits for a subtask on a different queue.
186186
- When a parent task waits for a subtask on the same queue.
@@ -288,3 +288,13 @@ export const subsubtask = task({
288288
},
289289
});
290290
```
291+
292+
Now this will result in a `RECURSIVE_WAIT_DEADLOCK` error because the parent task is waiting for the subtask, and the subtask is waiting for the subsubtask, but there is no more concurrency available in the queue. It will look a bit like this in the logs:
293+
294+
![Recursive task deadlock](/images/recursive-task-deadlock-min.png)
295+
296+
### Mitigating recursive wait deadlocks
297+
298+
If you are recursively triggering and waiting for tasks on the same queue, you can mitigate the risk of a deadlock by increasing the concurrency limit of the queue. This will allow you to trigger and wait for more subtasks.
299+
300+
You can also use different queues for the parent task and the subtask. This will allow you to trigger and wait for more subtasks without the risk of a deadlock.

packages/core/src/v3/links.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export const links = {
1616
concurrentWaits: "https://trigger.dev/docs/troubleshooting#parallel-waits-are-not-supported",
1717
},
1818
concurrency: {
19-
recursiveDeadlock: "https://trigger.dev/docs/queue-concurrency#recursive-queue-deadlock",
19+
recursiveDeadlock:
20+
"https://trigger.dev/docs/queue-concurrency#waiting-for-a-subtask-on-the-same-queue",
2021
},
2122
},
2223
site: {

0 commit comments

Comments
 (0)