Skip to content

IVF-PQ tests: fix segfault when accessing empty lists#838

Merged
rapids-bot[bot] merged 2 commits intorapidsai:branch-25.06from
achirkin:fix-tests-ivf-pq-list-empty-segfault
Apr 24, 2025
Merged

IVF-PQ tests: fix segfault when accessing empty lists#838
rapids-bot[bot] merged 2 commits intorapidsai:branch-25.06from
achirkin:fix-tests-ivf-pq-list-empty-segfault

Conversation

@achirkin
Copy link
Copy Markdown
Contributor

Check if the index.lists()[label] is not an empty shared pointer before accessing its content in tests.

If the list size is zero, the list shared pointer can be .reset() during deserialization/resizing. Hence IVF-Flat and IVF-PQ can sometimes have empty shared pointers in their .lists() members. In case of IVF-PQ, we've had a piece of tests where this wasn't checked before accessing. As a result, we have been observing occasional CI failures with segfaults - when the IVF-PQ index was very unbalanced, i.e. had empty lists.

So far, the affected test is the only place I could identify where the access to the list pointer is unprotected (either via explicit check or by the invariant list_size > 0).

@achirkin achirkin added bug Something isn't working non-breaking Introduces a non-breaking change labels Apr 23, 2025
@achirkin achirkin self-assigned this Apr 23, 2025
@achirkin achirkin requested a review from a team as a code owner April 23, 2025 09:03
@achirkin achirkin moved this to In Progress in Unstructured Data Processing Apr 23, 2025
@github-actions github-actions Bot added the cpp label Apr 23, 2025
Copy link
Copy Markdown
Contributor

@tfeher tfeher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@achirkin
Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot rapids-bot Bot merged commit b801218 into rapidsai:branch-25.06 Apr 24, 2025
66 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Unstructured Data Processing Apr 24, 2025
rapids-bot Bot pushed a commit that referenced this pull request May 27, 2025
Check if the `index.lists()[label]` is not an empty shared pointer before accessing its content in tests.

This is a follow-up on #838, in which I fixed this problem in one place, but not in two others in the same file.

Authors:
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #933
mythrocks pushed a commit to mythrocks/cuvs that referenced this pull request Jun 3, 2025
Check if the `index.lists()[label]` is not an empty shared pointer before accessing its content in tests.

This is a follow-up on rapidsai#838, in which I fixed this problem in one place, but not in two others in the same file.

Authors:
  - Artem M. Chirkin (https://github.com/achirkin)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: rapidsai#933
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cpp non-breaking Introduces a non-breaking change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants