Repository navigation
Fix chord errbacks given as a single signature - #10907
avanish-garg wants to merge 3 commits into
Conversation
link_error may hold a single signature or a list of them, and every
other reader wraps it with maybe_list(). chord_error_from_stack() and
_handle_group_chord_error() iterated it directly, so a chord body with
a single errback (e.g. body.set(link_error=eb.s())) iterated the
signature's keys: the errback never ran and one bogus task per key
('task', 'args', 'kwargs', ...) was published instead.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10907 +/- ##
=======================================
Coverage 90.63% 90.63%
=======================================
Files 153 153
Lines 21471 21471
Branches 2634 2634
=======================================
Hits 19461 19461
Misses 1697 1697
Partials 313 313
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
MehrazRumman
left a comment
There was a problem hiding this comment.
Checked at d34bda9.
- The fix is right.
link_errorcan hold a single signature (sig.set(link_error=eb.s())), and aSignatureis adict, so iterating it yielded its keys.maybe_list(...) or []matches howcanvas.pyalready reads the option (lines 836 and 1201). After this change, those two sites inbackends/base.pywere the only remaining direct reads ofoptions['link_error']incelery/. The Redis backend's chord error path goes throughchord_error_from_stack, so it is covered too. t/unit/backends/test_base.pypasses (197 passed). The twosingle_signaturecases fail againstmain, and thelistcases pass on both.
CI: the three failed smoke jobs (test_worker_heartbeats, test_rpc_backend, test_task_queue_max_priority) never started their tests. Each one failed while downloading the useblacksmith/setup-docker-builder action ("download has timed out ... after 3 attempts"), and that cancelled the rest of the smoke matrix. It's a runner problem, not this change; a re-run should clear it.
Looks good to me.
|
@subham-hq is this a duplicate of your merged fix? |
Note: Before submitting this pull request, please review our contributing
guidelines.
Description
Fixes #10906
link_errormay hold a single signature or a list, and every other reader wraps it withmaybe_list().Backend.chord_error_from_stack()andBackend._handle_group_chord_error()iterated the option directly. A chord body with one errback, such astsum.s().set(link_error=eb.s()), therefore had the signature's keys iterated. The errback never ran, and one bogus task per key ('task','args','kwargs', ...) was published, showing up on the worker as "Received unregistered task of type 'task'". For a group body this happened once per body task.Changes:
celery/backends/base.py: both sites now passmaybe_list(<callback>.options.get("link_error")) or [], the same idiom used incanvas.pyandapp/task.py.t/unit/backends/test_base.py:test_chord_error_from_stack_accepts_a_single_errbackandtest_handle_group_chord_error_accepts_a_single_errback, each parametrized over a single signature and a list. The single-signature cases fail onmainand pass with this change.Testing:
pytest t/unit/backends t/unit/tasks: 1953 passed, 49 skipped, 1 xfailed..pre-commit-config.yaml, are clean on the changed files.No unregistered-task errors are logged on this branch.