Skip to content

Conversation

@maccinza
Copy link
Contributor

Description

This PR introduces an integration test that reproduces the issue described in Discussion #9742, where:

celery.chord_unlock tasks are routed to a declared quorum queue (bound to a topic exchange), but are either never consumed or endlessly retried, with rare occasions when it is successfully run.

✅ Summary of the test:

Chords are submitted before any worker is running.
chord_unlock is explicitly routed to a quorum queue via a topic exchange.
A worker is later started that consumes from both the header and callback queues.
The test verifies that all chord results complete successfully.

❌ Observed behavior:

A significant number of chord results remain pending or fail due to the chord_unlock task being ignored or retried indefinitely.

✅ Expected behavior:

The chord_unlock task should be routed correctly and consumed by the worker since the queue is explicitly declared and consumed.

@codecov
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.52%. Comparing base (2a03096) to head (402f284).
⚠️ Report is 44 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9766   +/-   ##
=======================================
  Coverage   78.52%   78.52%           
=======================================
  Files         153      153           
  Lines       19130    19130           
  Branches     2533     2533           
=======================================
  Hits        15021    15021           
  Misses       3821     3821           
  Partials      288      288           
Flag Coverage Δ
unittests 78.49% <ø> (ø)

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.

@auvipy auvipy requested a review from Copilot June 18, 2025 07:22

This comment was marked as outdated.

@auvipy
Copy link
Member

auvipy commented Jun 18, 2025

interestingly, the tests are passing!

@maccinza
Copy link
Contributor Author

interestingly, the tests are passing!

I guess it is actually XFailing, but the issue is intermittent, it can rarely work as expected with all chords being correctly run.

@maccinza maccinza marked this pull request as ready for review June 18, 2025 16:26
@auvipy auvipy requested review from auvipy and Copilot June 19, 2025 04:19
Copy link
Contributor

Copilot AI left a comment

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 adds an integration test that reproduces the chord_unlock routing issue when using a quorum queue with a topic exchange. Key changes include:

  • A new test file with fixtures to set up a Celery app with specific queue and routing configurations.
  • A stress test that submits multiple chords before starting a worker to capture the routing deficiencies.
  • An update to the pytest markers in pyproject.toml to include the "amqp" marker.

Reviewed Changes

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

File Description
t/integration/test_rabbitmq_chord_unlock_routing.py Introduces an integration test to replicate chord_unlock routing issues.
pyproject.toml Updates marker list by adding the "amqp" marker.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

what do you think about using logging instead of print?

auvipy and others added 3 commits June 19, 2025 06:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@auvipy auvipy added this to the 5.5.4 milestone Jun 19, 2025
@auvipy auvipy requested a review from Nusnus June 19, 2025 06:45
@maccinza maccinza requested a review from auvipy June 20, 2025 20:17
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

the tests looks good. need to work on the fix next

@maccinza maccinza requested a review from auvipy June 23, 2025 13:31
@auvipy auvipy merged commit dd4cf64 into celery:main Jun 25, 2025
122 of 124 checks passed
@auvipy auvipy modified the milestones: 5.5.4, 5.6.0 Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants