Background jobs have explicit retry caps
Why it matters
Background jobs without retry caps are poison-message traps: any job that fails consistently due to a logic bug, bad data, or downstream API change will be retried indefinitely by BullMQ (default: unlimited), Agenda, and similar libraries. CWE-770 describes the outcome — unbounded retries consume Redis storage (the job stays in the failed set), worker CPU (each retry fires job processing logic), and can trigger cascading failures if the job calls external APIs. The retry storm also obscures monitoring: a dead-letter queue that fills silently hides the bug that caused the original failure, delaying the production fix.
Severity rationale
High because infinite retries from a single poison message consume continuous Redis and worker resources, masking the underlying bug indefinitely rather than surfacing it for repair.
Remediation
Set attempts and backoff at every queue.add() call site. Three attempts with exponential backoff gives transient-failure recovery without burning resources on permanent failures.
// Bad: no cap — retries forever
await queue.add('send-welcome', { userId })
// Good: 3 attempts, exponential backoff
await queue.add('send-welcome', { userId }, {
attempts: 3,
backoff: { type: 'exponential', delay: 2000 },
removeOnComplete: { count: 100 },
removeOnFail: { count: 50 },
})
Also configure the Worker's failed event listener so failures route to Sentry or your alerting stack — removeOnFail alone causes silent discard, which is the opposite of visibility.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Hidden Cost Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-770 — Allocation of Resources Without Limits or Throttling
- iso-25010:2011 · reliability
- soc2:2017 · A1.1 — Processing capacity monitoring and management
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-cost-bombs·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (A1.1) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2