fix(kv): stop retrying SubscribeKvEvents when backend returns UNIMPLEMENTED - #577
Conversation
…MENTED Signed-off-by: Chang Su <chang.s.su@oracle.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the KV event monitor's error handling by introducing a mechanism to gracefully manage situations where a backend does not support the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe KV event monitor now handles Unimplemented status errors from initial subscribe_kv_events calls by logging a warning and returning early to disable subscription. Other errors continue retrying with backoff as before. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses an issue where the KV event monitor would endlessly retry connecting to a backend that doesn't implement the SubscribeKvEvents RPC. The change introduces a check for the UNIMPLEMENTED gRPC status code and gracefully stops the subscription loop for that worker, preventing log spam and unnecessary retries. The implementation is sound. I have one minor suggestion to make the code more concise.
| if let Some(status) = e.downcast_ref::<tonic::Status>() { | ||
| if status.code() == tonic::Code::Unimplemented { | ||
| warn!( | ||
| worker_url = %worker_url, | ||
| "Backend does not implement SubscribeKvEvents, \ | ||
| disabling KV event subscription for this worker" | ||
| ); | ||
| return; | ||
| } | ||
| } |
There was a problem hiding this comment.
For improved conciseness and readability, you can combine the nested if let and if statements into a single if statement using the matches! macro with a guard. This expresses the condition in a single, fluent line.
if matches!(e.downcast_ref::<tonic::Status>(), Some(status) if status.code() == tonic::Code::Unimplemented) {
warn!(
worker_url = %worker_url,
"Backend does not implement SubscribeKvEvents, \
disabling KV event subscription for this worker"
);
return;
}
Description
Problem
When a gRPC backend (e.g. vLLM) does not implement the
SubscribeKvEventsRPC, the KV event monitor retries forever with exponential backoff (100ms → 30s), spamming warning logs. This RPC will never succeed for backends that don't support it.Solution
Before retrying, downcast the error to
tonic::Statusand check forCode::Unimplemented. If detected, log a single warning and exit the subscription loop permanently for that worker.Changes
kv_event_monitor.rssubscription_loop, added early return whensubscribe_kv_eventsfails with gRPCUNIMPLEMENTEDstatus code.Test Plan
SubscribeKvEventssupportChecklist
cargo +nightly fmtpassescargo clippy --all-targets --all-features -- -D warningspassesSummary by CodeRabbit