Skip to content

[Serve] Remove shutdown() method from TaskProcessorAdapter#59713

Merged
abrarsheikh merged 4 commits intoray-project:masterfrom
krisselberg:fix-task-consumer-del-shutdown
Dec 30, 2025
Merged

[Serve] Remove shutdown() method from TaskProcessorAdapter#59713
abrarsheikh merged 4 commits intoray-project:masterfrom
krisselberg:fix-task-consumer-del-shutdown

Conversation

@krisselberg
Copy link
Contributor

@krisselberg krisselberg commented Dec 27, 2025

Description

Fix @task_consumer decorator's del method calling shutdown() which broadcasts to all Celery workers instead of just the local one. This kills newly started workers during rolling updates.

Related issues

None

Additional information

Removed self._adapter.shutdown() from del - only stop_consumer() should be called since it targets the specific worker hostname. Also removed shutdown() implementation & from interface given it is not used anywhere

…stop_consumer()

Signed-off-by: krisselberg <kselberg@princeton.edu>
@krisselberg krisselberg requested a review from a team as a code owner December 27, 2025 06:10
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a critical issue in the task_consumer's __del__ method by removing the call to shutdown(). This change prevents a broadcast shutdown of all workers when a single replica is terminated, which is crucial for the stability of rolling updates. The fix is well-justified and implemented correctly.

The new unit test test_task_consumer_cleanup_only_calls_stop_consumer is an excellent addition. It clearly verifies the intended behavior and ensures this regression won't occur in the future.

I've added one minor comment regarding the test implementation, suggesting a potential future refactoring for the mock object to improve test isolation. Overall, this is a high-quality contribution that improves the robustness of Ray Serve.

@abrarsheikh
Copy link
Contributor

@harshit-anyscale could you take a look

@harshit-anyscale harshit-anyscale added the go add ONLY when ready to merge, run all tests label Dec 29, 2025
Signed-off-by: krisselberg <kselberg@princeton.edu>
…risselberg/ray into fix-task-consumer-del-shutdown

Signed-off-by: krisselberg <kselberg@princeton.edu>
@krisselberg krisselberg changed the title [Serve] Fix task_consumer __del__ calling shutdown() instead of only stop_consumer() [Serve] Remove shutdown() method from TaskProcessorAdapter Dec 29, 2025
Copy link
Contributor

@harshit-anyscale harshit-anyscale left a comment

Choose a reason for hiding this comment

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

LGTM!

@abrarsheikh abrarsheikh merged commit c5b2a28 into ray-project:master Dec 30, 2025
6 checks passed
AYou0207 pushed a commit to AYou0207/ray that referenced this pull request Jan 13, 2026
…ct#59713)

## Description
Fix @task_consumer decorator's __del__ method calling shutdown() which
broadcasts to all Celery workers instead of just the local one. This
kills newly started workers during rolling updates.

## Related issues
None

## Additional information
Removed self._adapter.shutdown() from __del__ - only stop_consumer()
should be called since it targets the specific worker hostname. Also
removed shutdown() implementation & from interface given it is not used
anywhere

---------

Signed-off-by: krisselberg <kselberg@princeton.edu>
Signed-off-by: jasonwrwang <jasonwrwang@tencent.com>
lee1258561 pushed a commit to pinterest/ray that referenced this pull request Feb 3, 2026
…ct#59713)

## Description
Fix @task_consumer decorator's __del__ method calling shutdown() which
broadcasts to all Celery workers instead of just the local one. This
kills newly started workers during rolling updates.

## Related issues
None

## Additional information
Removed self._adapter.shutdown() from __del__ - only stop_consumer()
should be called since it targets the specific worker hostname. Also
removed shutdown() implementation & from interface given it is not used
anywhere

---------

Signed-off-by: krisselberg <kselberg@princeton.edu>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…ct#59713)

## Description
Fix @task_consumer decorator's __del__ method calling shutdown() which
broadcasts to all Celery workers instead of just the local one. This
kills newly started workers during rolling updates.

## Related issues
None

## Additional information
Removed self._adapter.shutdown() from __del__ - only stop_consumer()
should be called since it targets the specific worker hostname. Also
removed shutdown() implementation & from interface given it is not used
anywhere

---------

Signed-off-by: krisselberg <kselberg@princeton.edu>
Signed-off-by: peterxcli <peterxcli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community go add ONLY when ready to merge, run all tests serve Ray Serve Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants