Repository navigation
Docs: notes on a killed beat, clock skew, and handlers on a lost process - #11094
Open
ChristianMurphy wants to merge 3 commits into
Open
ChristianMurphy wants to merge 3 commits into
ChristianMurphy wants to merge 3 commits into
Conversation
beat writes its schedule file on the first send after a start, then every three minutes, and at a clean stop. A beat that is killed in between starts again from the older file and sends the last run of an entry a second time. The beat_sync_every docs describe the timing of the sync and not this effect.
12 of 19 tasks
…st process countdown and a numeric expires become a time on the sender's clock, and the worker compares it with its own clock: with skewed clocks a task can start early, or be discarded early or run after its expiry. When the pool process that runs a task is lost, FAILURE is stored, errbacks run and task_failure is sent from the main process, but Task.on_failure and after_return are not called.
auvipy
self-requested a review
November 19, 2026 03:29
auvipy
approved these changes
Nov 19, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Before submitting this pull request, please review our contributing
guidelines & Anti AI spamming Guidelines. Before opening an AI based PR make sure you asked
in the discussion forum or in the related open issues first.
Description
Three notes for long-standing behaviour the docs don't mention. Docs only, 27 lines, two commits. This PR now includes #11095, as I offered on #11091, so there is one docs PR to review.
beat_sync_every(configuration): a beat that is killed between two writes of its schedule file starts again from the older file and sends a run a second time.countdownandexpires(calling guide): both depend on the sender's and the worker's clocks agreeing.on_failure()andafter_return()(task guide): neither is called when the pool process that runs the task is lost.Measurements on main (9c2f238): a killed beat
celery beatwith onecrontab(minute='*')entry, stopped 5 s after a send and started againbeat_sync_every = 1kombu main (
445027e), Redis broker, the defaultPersistentScheduler. The cause is inScheduler.should_sync()(celery/beat.py:416): with the default, beat syncs on the first send after a start and then when 3 minutes have passed.Measurements on main (9c2f238): clock skew, and a lost pool process
countdown=5, worker aheadexpires=5, worker aheadexpires=2behind a 5 s task, worker behindWith equal clocks the countdown started after 5.0 s, and the
expires=2task was discarded. The calling guide says a task is guaranteed to run after its ETA. The note goes right below that.When the pool process that runs a task is lost, FAILURE is stored, the errback runs and
task_failureis sent, butTask.on_failure()andafter_return()are not called, in 2 of 2 runs. Since 5.7 a hard time limit calls both handlers from the main process. If you'd rather have a lost process do the same, I can look at that in place of the note.