leaves12138 commented on code in PR #62:
URL: 
https://github.com/apache/paimon-vector-index/pull/62#discussion_r3651789409


##########
cpp/test_vindex.cpp:
##########
@@ -143,48 +143,91 @@ static void run_roundtrip(
     writer.write_index(make_output(buf));
     ASSERT_TRUE(!buf.data.empty());
 
-    paimon::vindex::Reader reader(make_input(buf));
+    paimon::vindex::Reader* active_reader = nullptr;
+    bool reentrant_attempted = false;
+    bool reentrant_rejected = false;
+    auto input = make_input(buf);
+    if (expected_index_type == PAIMON_VINDEX_INDEX_TYPE_IVF_FLAT) {
+        auto base_read = input.read_ranges_fn;

Review Comment:
   `base_read` is local to this `if` block, but the replacement callback 
captures it by reference through `[&]` and is invoked only after the block has 
ended. That leaves a dangling `std::function` reference in 
`input.read_ranges_fn`. The current C++ CI aborts while opening the IVF-FLAT 
reader (`failed to open vector index reader`), while my local optimized build 
happens to pass, which is consistent with this use-after-scope. Could the 
callback capture `base_read` by value (for example, `base_read = 
std::move(base_read)`) instead?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to