You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(redis-worker): heal leaked concurrency slots instead of blocking on release failures
A failed slot release previously aborted its caller: completeMessage left the
message in flight to be re-delivered as a duplicate execution, the retry path
lost the attempt increment, and the reclaim path held messages in flight
indefinitely. Release is now best-effort on every path: the primary state
transition proceeds and the failure is logged.
The resulting leaks are recoverable in two ways. reserve re-admits a message
that already holds its own slot, since re-admission does not increase
concurrency. A reconcile loop removes any slot member with no in-flight
record; the check-and-remove is atomic and sound because a message is always
registered in flight before its slot is reserved.
Copy file name to clipboardExpand all lines: .changeset/fair-queue-concurrency-slot-leak.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,4 @@
2
2
"@trigger.dev/redis-worker": patch
3
3
---
4
4
5
-
Fair queue consumers no longer leak the concurrency slots that gate a tenant's throughput. Slots were held by messages that had already finished, were never reclaimed, and once enough of them accumulated every queue belonging to that tenant stopped being served. Slots are now freed on the paths that previously skipped them, freed before the record needed to recover them is discarded, and released before a reclaimed message goes back on the queue. A failed release is now surfaced instead of being silently treated as success.
6
-
7
-
Concurrency groups keyed on queue metadata rather than the tenant can still resolve to the wrong group when a consumer completes a message it did not enqueue, so this does not yet cover that case.
5
+
Fair queue consumers no longer leak the concurrency slots that gate a tenant's throughput, and leaked slots now heal themselves. Slots are freed on the completion, retry, dead-letter, and reclaim paths that previously skipped them, and a failed release never blocks the message's own state transition, so a Redis error can no longer turn into a duplicate execution or a lost retry. A periodic reconcile loop removes any slot whose message is no longer in flight, and a message that still holds its own slot from an earlier failed release is re-admitted instead of being blocked by it.
0 commit comments