-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix: (#9773) task_id must not be empty with chain as body of a chord #9774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9774 +/- ##
=======================================
Coverage 78.51% 78.52%
=======================================
Files 153 153
Lines 19129 19130 +1
Branches 2533 2533
=======================================
+ Hits 15020 15021 +1
Misses 3821 3821
Partials 288 288
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
thanks for the intensive tests! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
the integration tests seems to be very slow |
Yes, it seems to be related to the |
|
seems redis related integration test builds failed mostly.... may be due to timeout / network issues? |
So I investigated on the problem, the test that timed out was the one linked below (that runs only on redis backend, that's why only workflows with redis as backend were failing) celery/t/integration/test_canvas.py Lines 343 to 361 in ce7fe8a
And this is related to the fact that my initial approach used group_id as the task ID for the chord body: bodyres = body.freeze(group_id, root_id=root_id)it created Redis key collisions because both the group coordination and body task result were trying to use the same Redis key. This caused the integration tests to timeout waiting for results. The correct fix I just pushed should be: body_task_id = task_id or uuid()
bodyres = body.freeze(body_task_id, group_id=group_id, root_id=root_id)This ensures both the task_id not to be None and the correct link between the body and the header passing the group_id as specific kw argument. |
|
nice finding! |
cde1ef0 to
f9ec6e4
Compare
|
you can also update the PR description as the original fix have changed |
Fixes chaoss#3458 Updates Celery from ~=5.5 to >=5.6.0 to fix a bug where task_id becomes None during exception handling while executing a task chain within a chord. This was reported in celery/celery#9774 and fixed in Celery 5.6.0. Signed-off-by: ANJAN672 <rockyanjan672@gmail.com>
Description
(Fixes #9773)
When using chords with a group containing failing tasks and a chain body, error propagation fails with:
This happens because the chord body can be frozen with
Noneas its task ID, causing error handling to break when trying to propagate failures from the group to the callback.Root Cause
In
celery/canvas.py, the_chord.run()method was freezing the body with a potentiallyNonetask_id:The issue:
task_idcan beNonewhen chord is called without explicit IDcallback.idto propagate the errorNone,callback.idends up beingNoneSolution
Ensure the chord body always gets a valid, unique task ID while maintaining proper group relationships:
Why this is correct:
None)group_idparameterTesting
The fix includes tests covering: