Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fix request disconnect check when BaseHTTPMiddleware is present #11096

Closed
wants to merge 3 commits into from

Conversation

tomeras91
Copy link
Contributor

@tomeras91 tomeras91 commented Dec 11, 2024

This PR fixes #10087, by using a different method to check if a request has disconnected (instead of starlette's Request.is_disconnected(), which doesn't work as expected in case a BaseHTTPMiddleware is added to the server - see here - encode/starlette#2094).

The PR uses the method suggested in encode/starlette#2094 (comment)

Added a test that fails on main, and is fixed with this PR

Benchmark

Model: Qwen/Qwen2.5-1.5B-Instruct
Hardware: single H100
Serve run command: vllm serve Qwen/Qwen2.5-1.5B-Instruct

Endpoint: v1/completions
(benchmark run command: python3 benchmark_serving.py --model Qwen/Qwen2.5-1.5B-Instruct --dataset-path ShareGPT_V3_unfiltered_cleaned_split.json)

branch throughput (requests/s) mean TTFT (msec) mean TPOT (msec) Total generated tokens
main (commit 82c73fd) 52.12 6117.88 24.92 189868
pr (commit 0ba0ff8) 52.52 6064.14 24.20 190241

Conclusion: The fix doesn't hurt performance at all. I guess this is because request.recieve() used here is generally non-blocking

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@mergify mergify bot added the frontend label Dec 11, 2024
@tomeras91
Copy link
Contributor Author

CC @njhill

vllm/utils.py Outdated Show resolved Hide resolved
@DarkLight1337
Copy link
Member

As per offline discussion, we have decided to fix it via #11190 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Requests aren't aborted when client disconnects if user provided a middleware
2 participants