Skip to content

Conversation

@woolfred
Copy link
Contributor

@woolfred woolfred commented Sep 22, 2025

Hello again 👋
This time with another problem: We saw that from time to time our periodic jobs aren't run anymore and since then tried to find out why.
Over time we added a dead man switch to the worker and lastly monitoring to the heartbeat. Now we think we found at least one part of the problem:

On the weekend we got two applications which had heartbeats but stopped to schedule on periodic tasks.
As we dug through the code we stumbled over the side tasks which are started but not monitored so that potential issues within the started task never show up. As there is no await the exceptions within a task won't be raised.
We suspect that the periodic_deferrer task stopped, probably due to the short network issues and that leaves us with a running worker, while no periodic tasks getting scheduled anymore.
As we can't do anything about the Azure problems, this is our suggestion to deal with problems if one of the side tasks dies.

c09370b adds a test with the current behavior: A side task fails and the runner continues to run.
7765591 adds the new behavior with a test, which should be a breaking change.

As the logic within the side tasks is essential for a working application we think stopping the worker is the right move. After shutdown the worker could be restarted automatically via the infrastructure.

Successful PR Checklist:

  • Tests
    • (not applicable?)
  • Documentation
    • (not applicable?)

PR label(s):

@woolfred woolfred requested a review from a team as a code owner September 22, 2025 14:59
@github-actions github-actions bot added PR type: breaking 💥 Contains breaking changes PR type: bugfix 🕵️ Contains bug fix labels Sep 22, 2025
@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  procrastinate
  worker.py 570-579
Project Total  

This report was generated by python-coverage-comment-action

@ewjoachim
Copy link
Member

I appreciate your contribution and it sounds awesome. Also, I know I won't have the time to make a thorough review in the next few weeks, please know it had nothing to do with the quality or anything. (I definitely would rather we had a few more people in the maintenance team ^^')

@woolfred
Copy link
Contributor Author

woolfred commented Dec 5, 2025

Hey @ewjoachim, just a friendly reminder that this PR is still waiting on a review and it's getting close to 3 month.

Do you think this behaviour needs to be documented? Maybe somewhere or even as a new section in Going to production?

Copy link
Member

@ewjoachim ewjoachim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome :) Sorry for the delay.

@ewjoachim ewjoachim merged commit 8cb92c9 into procrastinate-org:main Dec 8, 2025
17 checks passed
@ewjoachim
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR type: breaking 💥 Contains breaking changes PR type: bugfix 🕵️ Contains bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants