Skip to content

fix: avoid cycle detection in native delayed delivery (#10095)#10112

Merged
auvipy merged 1 commit into
celery:v5.6.xfrom
Izzette:backport-fix-rabbitmq-3.x-cycle-detection-native-delayed-delivery-v5.6.x
Mar 1, 2026
Merged

fix: avoid cycle detection in native delayed delivery (#10095)#10112
auvipy merged 1 commit into
celery:v5.6.xfrom
Izzette:backport-fix-rabbitmq-3.x-cycle-detection-native-delayed-delivery-v5.6.x

Conversation

@Izzette

@Izzette Izzette commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Description

Backports #10095 to v5.6.x

* fix: avoid cycle detection in native delayed delivery

* Avoid RabbitMQ <4.0.1 dead-lettering cycle detection when retrying with native delayed-delivery.

* chore: fix typo, rename, unused variable

---------

Co-authored-by: Asif Saif Uddin {"Auvi":"অভি"} <[email protected]>
@Izzette
Izzette changed the base branch from main to v5.6.x February 12, 2026 15:05
@codecov

codecov Bot commented Feb 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.50%. Comparing base (a0e6996) to head (5f64516).
⚠️ Report is 63 commits behind head on v5.6.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           v5.6.x   #10112      +/-   ##
==========================================
- Coverage   88.47%   87.50%   -0.97%     
==========================================
  Files         153      153              
  Lines       19375    19381       +6     
  Branches     2228     2229       +1     
==========================================
- Hits        17142    16960     -182     
- Misses       1934     2125     +191     
+ Partials      299      296       -3     
Flag Coverage Δ
unittests 87.49% <100.00%> (-0.96%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Izzette
Izzette marked this pull request as ready for review February 12, 2026 15:27
@auvipy
auvipy requested review from Nusnus and Copilot February 14, 2026 07:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR backports a fix from v5.7 to v5.6.x to address RabbitMQ cycle detection issues when retrying tasks with native delayed delivery. The fix prevents RabbitMQ versions <4.0.1 from detecting dead-lettering cycles by stripping x-death-related headers before republishing tasks during retries.

Changes:

  • Added X-Death header filtering in the Context class to prevent RabbitMQ cycle detection issues during task retries
  • Added comprehensive unit tests to verify X-Death headers are properly filtered while preserving custom headers
  • Added integration tests to verify the fix resolves the RabbitMQ cycle detection issue with quorum queues and native delayed delivery

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
celery/app/task.py Defines X_DEATH_HEADERS constant and adds _filter_x_death_headers method to Context class, filtering headers in as_execution_options
t/unit/tasks/test_tasks.py Adds unit test verifying X-Death headers are filtered out while preserving custom headers
t/integration/test_rabbitmq_quorum_queue_cycle_detection.py New integration tests reproducing and verifying the fix for RabbitMQ cycle detection with quorum queues

@auvipy auvipy added this to the 5.6.x milestone Feb 18, 2026
@auvipy
auvipy self-requested a review February 18, 2026 11:17
@liran-cohen-hs

Copy link
Copy Markdown

@auvipy thank you so much for this !
this will help us a lot in the migration to quorum

@auvipy
auvipy merged commit 0fa93fb into celery:v5.6.x Mar 1, 2026
325 of 326 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants