Repository navigation
Stop the result store wait before the worker's own time limits - #11183
Open
ChristianMurphy wants to merge 2 commits into
Open
ChristianMurphy wants to merge 2 commits into
ChristianMurphy wants to merge 2 commits into
Conversation
While a task runs, its pool process waits out a short result backend outage, and stops before the task's time limit so the task can still be requeued. The wait knew the limits of the task and of the message, but not the worker's --time-limit and --soft-time-limit, which the pool gives a task without a limit. Such a task was interrupted while it waited: with --time-limit it never ran, with --soft-time-limit it stored FAILURE without running. The worker now sends the tracer the limits its pool enforces. They travel on a copy of the request, so they are no header of the task and no retry publishes them. Pools that enforce no limit send none. The wait stops before the next limit to fire. Once the soft limit has fired it stops before the hard one: before, the last state of a task that hit its soft limit was stored without any wait.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11183 +/- ##
=======================================
Coverage 91.82% 91.83%
=======================================
Files 153 153
Lines 22314 22341 +27
Branches 2798 2806 +8
=======================================
+ Hits 20490 20517 +27
Misses 1529 1529
Partials 295 295
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
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
The follow-up to #11014 that @auvipy asked for in #11014 (comment).
A worker started with
--time-limitor--soft-time-limitstill losesacks_latetasks during a short result backend outage. The wait from #11014 stops before the time limit of the task or of the message, but it did not know the worker's own limits, which the pool gives a task without one. The task was interrupted while it waited.A 15 s outage, four tasks with
task_track_startedandacks_late:--time-limit 8PENDING--soft-time-limit 5FAILUREwithout running--time-limit 8, 45 s outagePENDINGThe change:
task.requestand a retry does not publish them.It doesn't add a setting or a public name. A worker without a time limit sends the same request as before, and the lookup takes about 0.6 microseconds per task.
Not changed here, and the same on main today: with
result_backend_always_retrythe wait keeps retrying past the limit, and a store attempt that blocks (dropped packets with a long socket timeout) can run into the limit.Tests and other runs
t/smoke/tests/test_backend_outage.py, a worker with--time-limit=8and one with--soft-time-limit=5. Both fail on main (one of five tasks never runs) and pass here.Backend.store_resultand for bothexecute_using_poolpaths. 24 of them fail on main's source, and each of eight bugs I planted fails at least one.task_time_limit = 8,time_limit=8on the message, both worker options together, andtask_time_limit = 6with--soft-time-limit 30.--soft-time-limitwhile the backend is down storesFAILUREonce the backend is back, as on main. A task on the threads pool with--time-limit(not enforced there) stores its result after the outage, as on main. A task that retries doesn't see a custom header, as on main.t/unit/worker,t/unit/tasks,t/unit/concurrency,t/unit/app/test_trace.pyand the base, Redis and database backend tests as tox runs them (python -bb): 2934 passed, and one Redis backend test that fails on main here too. flake8 and isort are clean.07ec498c4), kombu main (c706ebe6), Python 3.13, Redis 7.0 as broker and as a separate result backend, prefork with 2 processes.