Repository navigation
[Bugfix][Router] Validate static service discovery list lengths - #1084
Shaoting-Feng merged 6 commits into
Conversation
Signed-off-by: Alex-Wengg <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request refactors the validation of index-aligned lists in StaticServiceDiscovery by introducing a helper method _validate_index_aligned_lists and calling it during initialization and health checks. It also adds corresponding unit tests. The feedback suggests wrapping individual model health checks in a try...except block to prevent a single failure from aborting the entire health check loop.
chrikrah
left a comment
There was a problem hiding this comment.
Two things in _validate_index_aligned_lists worth fixing before this merges, both measured on
6a33ae4 against 83c22bd.
models stops being validated. The loop guards every entry with if values is not None, but
models is required, and the assert it replaces caught a None. Constructing with models=None:
6a33ae4 raises TypeError: object of type 'NoneType' has no len(), 83c22bd constructs and then
get_endpoint_info raises TypeError: 'NoneType' object is not iterable. A dynamic-config reload
reaches it, since dynamic_config.py:179 passes parse_comma_separated_args(config.static_models) and
that returns None when static_models is absent. reconfigure_service_discovery also builds the new
object at :1421 before close() at :1425, so today a bad reload is rejected and the running router
survives. Hoisting the required list out of the loop covers it.
return [] reads as "all healthy" to the only caller. check_model_health:303 assigns it wholesale
into unhealthy_endpoint_hashes and get_endpoint_info:356 skips only hashes in that list. Through your
own mutation path with the dead endpoint first, 6a33ae4 quarantines it and 83c22bd leaves it
routable.
The second one is my fault. My expected behaviour on #1083 asked for "returns nothing rather than a
partial result" and "so the router does not treat an unchecked backend as healthy", and for this return
type those are contradictory. You built the first.
The tests do hold the change. Reverting only service_discovery.py to 6a33ae4 and keeping them gives
4 failed, 8 passed.
Signed-off-by: Alex-Wengg <[email protected]>
|
Thanks both points were valid. missing models is now rejected during construction and an invalid list alignment quarantines every routable endpoint instead of treating them as healthy. I added regression coverage for both cases. |
…scovery-list-validation
|
@Shaoting-Feng The k8s-discovery-e2e-test failure looks infra-flaky rather than related to this change — the router pod was Running 1/1 the whole time, but the two opt125m engine pods never passed readiness within the 20-min timeout. The same workflow passed on main two hours later (run 34759534802 vs the main run at 14:26 UTC). I've updated the branch onto latest main. The workflows on the new head are queued pending approval, could you approve the runs when you get a chance? Thanks! |
|
@Alex-Wengg Yeah, it is a cold run issue causing the timeout. |
|
Hi @Shaoting-Feng , the CI failure appears to be in the Kubernetes discovery setup. The vllm-opt125m-decode and vllm-opt125m-prefill pods stayed Running but never became Ready (0/1) until the 20-minute timeout, while the router pod was Ready. do we need to rerun this again or do a log check? |
|
The timeout is not the problem, so raising it would not help. Measured across every attempt of
Nothing falls between 14.05 and 20.20. So no run would have passed at 25 minutes: readiness either arrives in about 12 minutes or it does not arrive. Three of the 18 are on Read through |
…scovery-list-validation
|
Hi @Shaoting-Feng, just checking in since it's been about a week. I've updated the branch onto latest main. Has the k8s-discovery readiness issue been resolved on the runners? If not, would it be possible to merge as is? Happy to make any other changes if needed. Thanks! |
chrikrah
left a comment
There was a problem hiding this comment.
e70018e closes both of my earlier findings. I should have said so on 13 September when you asked. Sorry for leaving an open review request on a pull request that already had an approval.
Verified at a4c506d:
$ python -m pytest src/tests/test_static_service_discovery.py -q
13 passed # main: 8 passed
Finding 1 was that models escaped validation. It now has its own check ahead of the loop. The is not None guard covers only the optional lists:
models=None -> ValueError: models must be provided
length mismatch -> ValueError: urls (2) and models (1) must have the same length
labels mismatch -> ValueError: urls (1) and model_labels (2) must have the same length
all aligned -> accepted
Finding 2 was the bare return []. The only caller reads it as all-healthy. Now get_unhealthy_endpoint_hashes returns a hash for every url and model pair when validation fails, so a bad config quarantines.
No objection from me. One limit: I did not run the wider suite, and I did not run anything that needs a cluster.
|
@ruizhang0101 @Shaoting-Feng thanks for updating the branch. The 5 CI workflows are waiting on "Approve and run" since this is a fork PR. Could one of you approve them so the checks can finish? |
|
@chrikrah let's gooo, it's been merged in. @Shaoting-Feng thank you for helping us get this merged in |
Summary
StaticServiceDiscoverypreviously validated onlyurlsagainstmodels. A mismatchedmodel_labelslist then failed withIndexErrorat request time, while a mismatchedmodel_typeslist let the health loop return a partial unhealthy set.This change:
assertwith an explicitValueError;FIX #1083
Validation
pytest -q src/tests/test_static_service_discovery.py— 12 passedpytest -q src/tests— 235 passedpre-commit run --files src/vllm_router/service_discovery.py src/tests/test_static_service_discovery.py— passed