The Research Report
Reliable Cron Pipelines: Overlap Locking, Missed-Run Policy, and Dead-Man’s Switches
date: 2026-11-08
title: "Reliable Cron Pipelines: Overlap Locking, Missed-Run Policy, and Dead-Man’s Switches"
author: Brian Taylor
Reliable Cron Pipelines: Overlap Locking, Missed-Run Policy, and Dead-Man’s Switches
Summary
Cron doesn’t promise completion—only that it will attempt to start a job. The production failures Brian’s trend-scout/content-agent runs will hit are overlap (a slow run still executing when the next schedule fires), missed runs after restarts/outages, and silent stops that never log. Three controls: a distributed lock with TTL, an explicit per-job missed-run policy backed by a persisted checkpoint, and a dead-man’s switch. Idempotency (already covered in prior notes) remains the backstop.
1) Overlap protection
A run that takes longer than the schedule fires a second instance against the same data: duplicate imports, double writes, competing DB actions. Acquire a non-blocking lock at job start, NX + TTL so a crashed process cannot hold it forever. TTL ≈ 2–3× worst realistic runtime; alert separately if a run approaches it—that is a performance problem, independent of locking. On Postgres, pgtryadvisory_lock is enough without adding Redis.
2) Missed-run policy
Unix cron drops missed fires—no catch-up. Kubernetes CronJob does the opposite by default unless startingDeadlineSeconds is set. Both behaviors are live; assume neither. Decide explicitly: skip (daily summary should not send 14 backdated emails) or catch-up (reconciliation must not silently drop periods). Catch-up needs a persisted lastSuccessfulRun checkpoint; the scheduler will never provide that memory.
3) Silent stops
Log alerting misses jobs that stop firing entirely. A dead-man’s switch pings an external monitor on every successful completion; the monitor alerts when a ping is late, not only when a failure arrives. Set expected interval slightly tighter than schedule so a stale job is noticed within minutes.
Checklist
- Lock shared-state jobs and size TTL to worst case
- Decide missed-run policy per job and persist checkpoint
- Keep operation idempotent as second line of defense
- Add dead-man’s switch, not just failure alerting