Skip to content

fix: keep IndexNode ABI stable across Cardinal builds - #1786

Merged
foxspy merged 2 commits into
zilliztech:mainfrom
marcelo-cjl:codex/keep-index-node-buildasync-abi-stable
Aug 21, 2026
Merged

fix: keep IndexNode ABI stable across Cardinal builds#1786
foxspy merged 2 commits into
zilliztech:mainfrom
marcelo-cjl:codex/keep-index-node-buildasync-abi-stable

Conversation

@marcelo-cjl

@marcelo-cjl marcelo-cjl commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

issue: #1687

What

  • Declare IndexNode::BuildAsync() unconditionally so KNOWHERE_WITH_CARDINAL no longer changes the public IndexNode vtable layout.
  • Add a non-Cardinal regression call that exercises the default IndexNode::BuildAsync() implementation.
  • Bump Cardinal v1 from v2.5.110 to v2.5.111; the new tag points to Cardinal merge commit 84968da from zilliztech/cardinal#916.

Why

KNOWHERE_WITH_CARDINAL is currently defined inside the embedded Knowhere CMake directory. Knowhere/Cardinal translation units see the macro, while an external consumer can include the same public header without it.

Because BuildAsync() was conditionally present near the start of IndexNode, every later virtual slot had two possible layouts. A consumer-side inline GetIdMap() call could therefore dispatch the Cardinal object's Count() slot instead, interpreting the integer return value as an IdMap& and crashing on a null dereference. This was observed in milvus-io/milvus#52724.

Public feature macros must not alter a cross-library base-class vtable. Keeping the virtual method present in both builds preserves one layout; non-Cardinal nodes use the existing default implementation, which delegates to Build().

Commits

  1. fix: keep IndexNode BuildAsync in public vtable
  2. fix: bump Cardinal v1 to v2.5.111

Validation

  • Non-Cardinal CPU + UT build passed.
  • Focused non-Cardinal Test index node passed (49 assertions / 1 case), including the default BuildAsync() call.
  • Cardinal CPU library build passed.
  • Cardinal refs verified: v1 v2.5.111@84968da, v2 v3.0.5@cf22bdf.
  • Cross-macro smoke passed: consumer compiled without KNOWHERE_WITH_CARDINAL against the Cardinal-enabled fixed libknowhere and called GetIdMap() successfully.
  • Milvus 3e402910f A/B test with index_engine=cardinal:
    • original Knowhere d85f7080: ordinary Indexing.HnswEmbListEmptyNullableUsesLogicalIds crashed in CardinalIndexNode::Count() with SIGSEGV / exit 139;
    • same workspace and build tree with this fix cherry-picked: the exact same test passed 1/1 / exit 0.

The Milvus fixed build deliberately retained the real compile-definition split (libknowhere macro ON, Milvus VectorDiskIndex.cpp macro OFF). Passing under that split confirms the fix stabilizes the public vtable rather than masking the issue by changing consumer flags.

Signed-off-by: marcelo-cjl <marcelo.chen@zilliz.com>
Signed-off-by: marcelo-cjl <marcelo.chen@zilliz.com>
@mergify

mergify Bot commented Aug 21, 2026

Copy link
Copy Markdown

@marcelo-cjl 🔍 Important: PR Classification Needed!

For efficient project management and a seamless review process, it's essential to classify your PR correctly. Here's how:

  1. If you're fixing a bug, label it as kind/bug.
  2. For small tweaks (less than 20 lines without altering any functionality), please use kind/improvement.
  3. Significant changes that don't modify existing functionalities should be tagged as kind/enhancement.
  4. Adjusting APIs or changing functionality? Go with kind/feature.

For any PR outside the kind/improvement category, ensure you link to the associated issue using the format: “issue: #”.

Thanks for your efforts and contribution to the community!.

@foxspy foxspy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm

@sre-ci-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: foxspy, marcelo-cjl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@foxspy
foxspy merged commit d7cfd88 into zilliztech:main Aug 21, 2026
11 of 13 checks passed
sre-ci-robot pushed a commit to milvus-io/milvus that referenced this pull request Aug 22, 2026
issue: #52723
issue: #52724
issue: #52725

## What

- Update Knowhere from `d85f7080` to `d7cfd888`.
- Pick up zilliztech/knowhere#1786, which keeps
`IndexNode::BuildAsync()` in the public vtable for both Cardinal and
non-Cardinal builds.
- Pick up the Cardinal v1 bump to `v2.5.111`, including its
nullable-index fix.

## Why

In a Cardinal-enabled Milvus build, Knowhere translation units define
`KNOWHERE_WITH_CARDINAL`, while Milvus core consumers of the same public
header do not. The previous conditional `BuildAsync()` declaration
therefore gave the two DSOs different `IndexNode` vtable layouts.

Calls intended for `GetIdMap()` could dispatch to `Count()` instead and
interpret its integer return as an `IdMap&`, causing the SIGSEGVs
reported in #52723, #52724, and #52725.

Knowhere `d7cfd888` makes the public vtable independent of that feature
macro.

## Validation

- No new local build or test was run for this dependency-pin-only
change; validation is delegated to Milvus PR CI.
- The underlying Knowhere fix passed Knowhere CI and a prior Milvus
Cardinal A/B reproduction: the affected ordinary HNSW test changed from
SIGSEGV/exit 139 on the old pin to 1/1 passed with the fix.

Signed-off-by: marcelo-cjl <marcelo.chen@zilliz.com>
sre-ci-robot pushed a commit to milvus-io/milvus that referenced this pull request Aug 22, 2026
pr: #52754
issue: #52723
issue: #52724
issue: #52725

Cherry-pick from master.

## What

- Update Knowhere from `d85f7080` to `d7cfd888`.
- Pick up zilliztech/knowhere#1786, which keeps
`IndexNode::BuildAsync()` in the public vtable for both Cardinal and
non-Cardinal builds.
- Pick up the Cardinal v1 bump to `v2.5.111`, including its
nullable-index fix.

## Why

In a Cardinal-enabled Milvus build, Knowhere translation units define
`KNOWHERE_WITH_CARDINAL`, while Milvus core consumers of the same public
header do not. The previous conditional `BuildAsync()` declaration
therefore gave the two DSOs different `IndexNode` vtable layouts.

Calls intended for `GetIdMap()` could dispatch to `Count()` instead and
interpret its integer return as an `IdMap&`, causing the SIGSEGVs
reported in #52723, #52724, and #52725.

Knowhere `d7cfd888` makes the public vtable independent of that feature
macro.

## Validation

- No new local build or test was run for this dependency-pin-only
cherry-pick; validation is delegated to Milvus PR CI.
- The underlying Knowhere fix passed Knowhere CI and a prior Milvus 3.0
Cardinal A/B reproduction: the affected ordinary HNSW test changed from
SIGSEGV/exit 139 on the old pin to 1/1 passed with the fix.

Signed-off-by: marcelo-cjl <marcelo.chen@zilliz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants