Skip to content

[serve] Clean up leaked receive task when request times out in direct ingress mode#64123

Open
akyang-anyscale wants to merge 2 commits into
ray-project:masterfrom
akyang-anyscale:alexyang/leaked-receive-task
Open

[serve] Clean up leaked receive task when request times out in direct ingress mode#64123
akyang-anyscale wants to merge 2 commits into
ray-project:masterfrom
akyang-anyscale:alexyang/leaked-receive-task

Conversation

@akyang-anyscale

Copy link
Copy Markdown
Contributor

Before, the receive task would be left on the queue because it was never canceled in the request timeout path. This PR fixes that and adds a test for it.

Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
@akyang-anyscale akyang-anyscale requested a review from a team as a code owner June 16, 2026 00:35
@akyang-anyscale akyang-anyscale added the go add ONLY when ready to merge, run all tests label Jun 16, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request ensures that the receive_task is properly cancelled alongside the request_task when an ASGI call times out, preventing task leaks. It also introduces a helper method to track in-flight direct-ingress tasks and adds a corresponding integration test to verify the cleanup behavior. The review feedback suggests two improvements: simplifying the coroutine name retrieval in the helper method by using the standard __name__ attribute instead of CPython internals, and simplifying the test headers by using standard strings instead of byte-encoded keys and values.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread python/ray/serve/_private/replica.py Outdated
Comment thread python/ray/serve/tests/test_direct_ingress.py Outdated
Signed-off-by: akyang-anyscale <alexyang@anyscale.com>
@ray-gardener ray-gardener Bot added the serve Ray Serve Related Issue label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants