Fix empty vector panic#9070
Merged
Merged
Conversation
JojiiOfficial
approved these changes
May 19, 2026
agourlay
approved these changes
May 19, 2026
generall
pushed a commit
that referenced
this pull request
May 22, 2026
* Add test * Validate empty vector name * Update test assertions
timvisee
pushed a commit
that referenced
this pull request
Jun 4, 2026
…9308) `validate_multi_vector_len(N, &[])` with N > 0 previously returned Ok: it passes the `vectors_count != 0` check, an empty `flatten_dense_vector` clears the size check, and `0.is_multiple_of(N)` is true, so it falls into the Ok branch. The unvalidated value then reaches `convert_to_plain_multi_vector`, where `dim = data.len() / vectors_count = 0`, the divisibility check `dim * vectors_count != data.len()` (0 == 0) passes, and `data.into_iter().chunks(0)` panics (itertools asserts the chunk size is non-zero). This is reachable from a single malformed gRPC Upsert via the deprecated `vectors_count` field. Add an `is_empty()` guard to `validate_multi_vector_len`, mirroring the sibling `validate_multi_vector_by_length`, so empty flattened data is rejected with a clear validation error before any conversion. Also add a defensive `vectors_count == 0 || data.is_empty()` guard at the top of `convert_to_plain_multi_vector`, which aligns it with the already-guarded `MultiDenseVectorInternal::try_from_flatten` and closes the same panic on the internal node-to-node `sync` path (where validation is log-only and `SyncPoints.points` is not validated). This completes the empty-vector hardening started in #9070, which covered the REST side only and did not touch the gRPC flattened `vectors_count` form. Includes a regression test covering both the rejected (empty) and accepted (consistent multivector) cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9045
Upserting an empty vector with wait=false can cause a panic. This fixes the problem by adding a validation rule and adds a test to assert behavior.
All Submissions:
devbranch (notmaster) and my branch was created fromdev.