You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix#4834 (canvas): fix chord error handling when body is a chain (#10247)
* fix(canvas): fix chord error handling when body is a chain (#4834)
Three bugs caused chord_error_from_stack to crash with TypeError
when a chord member failed and the chord body was a chain (created
by chain(chain(group(...), task), task)):
1. prepare_steps set self.id = last_task_id (the input parameter,
None) instead of the last task's actual UUID from results[0].id.
The chord body chain had id=None, causing get_key_for_task(None)
to crash in the error handler.
2. Errbacks set on the outer chain were applied to the chord task
but not to the chord body. chord_error_from_stack reads errbacks
from the body (request.chord), so link_error handlers never fired.
3. No defensive guard in chord_error_from_stack for callback.id
being None.
Fix:
- canvas.py prepare_steps: set chain ID to results[0].id
- canvas.py prepare_steps: propagate link_error to chord body
- backends/base.py chord_error_from_stack: generate UUID if
callback.id is None
Fixes#4834
* style: shorten inline comments
* test: add integration test for chord error in nested chain
Verifies that chain(chain(group(ok, failing), task), task) does not
crash with TypeError in chord_error_from_stack when a chord member
fails. The test checks that no 'task_id must not be empty' error
is logged during error propagation.
* fix: narrow exception assertion in integration test
Replace broad pytest.raises((ExpectedException, Exception)) with
explicit checks that the exception is not TypeError or the internal
ValueError from get_key_for_task. The chord failure itself is
expected, but internal errors are not.
---------
Co-authored-by: Asif Saif Uddin {"Auvi":"অভি"} <auvipy@gmail.com>
0 commit comments