Skip to content

Windows Python 3.14 parity: test_vector_read_your_writes missed 1 of 200 committed vectors once on main (intermittent) #409

Open

Description

@tae898

The scheduled run of test-native.yml on main of 2026-11-16 (run 43799876573, commit 4c95ed1) failed one job, "Parity against the installed wheel (windows-x64, Python 3.14)", with one failed test out of 3,447: tests/test_vector_read_your_writes.py::test_through_the_facade_a_task_finds_the_vector_it_committed_in_the_call_before.

The assertion: 1 of 200 committed vectors were not found by the next search: [(396, [162, 169, 427, 165, 454])]. It is not a crash (the existing --retry-crash of the Windows legs did not apply: crash 0, flaky_crash 0) and not a timeout. The same job passed on a re-run of the failed job (attempt 2), and the two previous scheduled runs (2026-11-15 and 2026-11-14) were green, so it is intermittent.

Why it is worth an issue and not only a re-run: the test checks the property that a vector committed in one call is found by the next search, the one an agent loop depends on (#306). One miss in 200 can be an approximate-search recall miss for a vector queried by itself, or a real visibility race between the commit and the index on this platform. The artifact native-parity-windows-x64-py3.14 of the run holds the per-file log and XML.

Proposal: keep rerunning a failed Windows leg once, as we do, and treat a second failure as real; do not auto-retry assertion failures (only crashes are retried today). For this test: run it in a loop on a Windows runner with the number of misses logged, then decide between a bug in the commit-to-search path and a test that should query with a slack (the vector must be among the top k, not first). If it fails again in the next two weeks it is quarantined with a marker and a tracking line here.

The policy for rerunning Windows legs is also not written in CONTRIBUTING.md or the CI docs; I will add it in the docs pull request of 26.11.1.post4.

Activity

  1. self-assigned this
    on Nov 16, 2026
  2. added
    bug
    python
    vector
    concurrency
    native
    on Nov 16, 2026
  3. added
    github_actions
    on Nov 16, 2026
  4. added this to the 26.12.1 milestone on Nov 16, 2026
  5. tae898 commented on Nov 16, 2026

    @tae898
    CollaboratorAuthor

    A second hit, and on Linux this time: PR #410 (the post4 release line into main), run 43863995512, job "Test arcadedb (linux/amd64, Python 3.12)", 3,596 passed and 1 failed: the same test, 1 of 200 committed vectors were not found by the next search: [(447, [271, 253, 169, 401, 386])]. So it is not Windows-specific and not a Python 3.14 matter. Hit 1 was the scheduled run on main at 4c95ed1 (before post4), so the cause is older than the post4 changes; the failing job is re-run to see whether it repeats on the same bytes.

    Two hits in two full runs is too few to give a rate, so my next step is a Java repro on the engine API (a committed vector missing from the very next search), in a loop on JDK 21 and 25, before anyone treats it as a CI flake.

    (Edited: the first version of this comment gave a rate of "two hits in about 7,000 test runs of this file"; that number counted the tests of two full suites, not runs of this test, so I removed it.)

  6. tae898 commented on Nov 16, 2026

    @tae898
    CollaboratorAuthor

    Correction to my comment above: I removed a rate that I could not support (it counted the tests of two full suites, not runs of this test). The failing job on #410 is re-run; the loop repro comes next.

  7. tae898 commented on Nov 17, 2026

    @tae898
    CollaboratorAuthor

    The failure reproduces locally, on Linux, and not only through the facade. The loop (600 planned iterations, one run of tests/test_vector_read_your_writes.py each, 4 tests per iteration) runs on the mini (i9-12900HK) in a systemd scope at nice 19 (I meant it to run on the 2 efficiency cores 12 and 13, but a user scope with AllowedCPUs does not pin a process on this host, so it ran on all 20 cores), with the native wheel that CI built from main (the artifact native-wheel-linux-x86_64 of run 44011962939, 26.12.1.dev0, commit 259e33639b), without conftest.py. The mini was loaded at the same time (load 10 to 24 from other jobs), which is closer to a shared CI runner than to a quiet machine.

    Result so far: 194 iterations, 193 pass and 1 failure, at iteration 82 (2026-11-17 06:07:07Z): test_a_task_finds_the_vector_it_committed_in_the_call_before (the plain database path, not the AsyncDatabase facade of the CI failure) with 1 of 200 committed vectors were not found by the next search: [(349, [144, 164, 326, 253, 95])]. The same assertion as the CI hits (the corpus is searched with ef_search of 400 and every vector is the nearest neighbour of itself at distance 0, so a miss is a write that the next search did not see, not approximate recall).

    So the race is not Windows-specific, not Python 3.14 specific and not a facade matter: it is in the commit-to-search path of the native build, at a rate of about one iteration in 190 under load. The failing output is saved with the loop's log (~/stage409/keep/ on the mini).

    Next: let the loop finish its 600 iterations for a rate, run the JVM build and the published 26.11.1.post4 native wheel (without the two facade tests, which need the module that only main has) for comparison, and then reduce it to a Java loop on the engine API, to see whether the engine or the binding is the place.

    (Edited 2026-11-17: the first version said the loop ran on 2 efficiency cores. It did not; it ran unpinned at nice 19 on a loaded machine. The failure counts are as read.)

  8. tae898 commented on Nov 17, 2026

    @tae898
    CollaboratorAuthor

    More data, 2026-11-17 06:39Z, from the loop of the comment above. At 06:31Z it stood at 194 iterations with 1 failure (that count was right at that time); at 06:39Z it stands at 218 iterations with 9, that is 8 failures in the last 24 iterations, after I started four more loops on the same mini (the load average went from about 10 to 40). I re-read every saved output and counted a run as a failure only when pytest itself printed failed (a JVM run that prints 2 passed and then exits nonzero is the separate JVM exit crash, and is not counted here). All runs: nice 19 and NOT pinned to any cores (my pin did not work, see the correction below), the mini loaded by other jobs:

    build iterations clean real test failures what failed
    native from main (CI wheel, 26.12.1.dev0) 218 209 9 1 of 200 committed vectors were not found (8), 2 of 200 ... (1)
    native, the published 26.11.1.post4 (the two tests without the facade, which post4 does not have) 30 24 6 1 of 200 ... (6)
    JVM from main 13 0 4 1 of 200 ... (3) and RecordNotFoundException: Record #1:446 not found raised from the vector search (1); the other 9 runs passed and then exited nonzero
    JVM, the published 26.11.1.post4 (two tests, no facade) 9 0 1 1 of 200 ... (1); the other 8 passed and exited nonzero

    So the published release is affected, on the native and on the JVM build, not only main. The rate depends on the load of the machine: 1 failure in the first 194 iterations of the native loop, 8 in the next 24 while the load was four times higher. That points at a timing race in the engine's commit-to-search path and not at the Python binding. The failing vector is not always the same (349, 492, 447, 456 and others), and (447, [271, 253, 169, 401, 386]) is exactly the signature of the CI failure on #410: the JVM run reproduced it.

    Next: a Java program on the engine API that replays the test (4 writers, 50 inserts each, a conflict retry, the search right after each commit) in a loop, against the released 26.11.1 jars and the main jars, so that it can be filed against the engine.

    (Edited 2026-11-17: the first version of this comment said that my earlier count of 1 failure in 194 was wrong and called the mini quiet during the first 100 iterations. Neither was right: the count was correct at 06:31Z and the load during those iterations was not measured.)

    (Second edit, 2026-11-17: the table's runs were unpinned, not on 2 efficiency cores each, as the first version of this line said; a user-level systemd scope with AllowedCPUs does not restrict cores on this host.)

  9. tae898 commented on Nov 17, 2026

    @tae898
    CollaboratorAuthor

    Correction to my comment of 06:39Z: it said that my count of 1 failure in 194 was wrong. It was right at the time (06:31Z); the failures came later, when the load of the mini rose. I edited the comment in place.

  10. tae898 commented on Nov 17, 2026

    @tae898
    CollaboratorAuthor

    Correction: my two comments above said the loop ran on 2 efficiency cores. It was not pinned: a user-level systemd scope with AllowedCPUs does not restrict cores on this host (no cpuset controller, Cpus_allowed_list stays 0-19), so it ran at nice 19 on all cores of a loaded machine. I edited both comments in place. The failure counts are as read.

  11. tae898 commented on Nov 17, 2026

    @tae898
    CollaboratorAuthor

    The race is in the engine, and it needs more than one writer. I wrote a Java repro against the engine API (no Python, no bindings, Repro.java, about 470 lines): writer threads each commit an insert (its own transaction, retried on NeedRetryException, as run_in_transaction(retries=60) does) and then, in the same thread, search k=5, efSearch=400 for the vector they just committed; a miss is that vector absent from the hits. A scenario is a fresh database with 300 base vectors of dimension 8 and an index whose graph is built first, then 4 writers with 50 inserts each (or 1 writer with 200). The JVM sees 2 cpus (affinity read back: 12 and 13, or 14 and 15, nice 19, on the mini). Every number below is read from the TOTALS block of its run.

    engine JDK writers scenarios committed inserts scenarios with a miss inserts missed search exceptions found by the immediate re-searches still missing on them missing after all writers ended
    26.11.1 (a3a5d1245) 25 4 200 40,000 47 (24%) 152 (0.38%) 6 124 34 1
    26.11.1 (a3a5d1245) 21 4 100 20,000 16 (16%) 18 (0.09%) 0 15 3 0
    main 515aff93c6 25 4 200 40,000 63 (32%) 154 (0.39%) 5 126 33 2
    main 515aff93c6 21 4 100 20,000 26 (26%) 28 (0.14%) 0 22 6 0
    26.11.1 (a3a5d1245) 25 1 100 20,000 0 (0%) 0 (0.00%) 0 0 0 0
    main 515aff93c6 25 1 100 20,000 0 (0%) 0 (0.00%) 0 0 0 0
    main 515aff93c6, rebuild threshold raised to 1,000,000 mutations 25 4 100 20,000 16 (16%) 21 (0.10%) 1 17 5 0

    The two re-search columns count misses and search exceptions together (RecordNotFoundException on loading a RID the index returned: 6 and 5 in the 200-scenario runs on JDK 25, none on JDK 21).

    What it shows:

    • One writer never misses (100 scenarios, 20,000 inserts, on both engines). With four writers 0.1 to 0.4 percent of the committed inserts are missed, on JDK 21 and on JDK 25, on the released 26.11.1 and on main. So it is not the Python bindings and not one JDK.
    • Most misses are found by the three immediate re-searches straight after; a few are still missing on them, and of those some appear within a second and a few are not found within 3 seconds (JDK 21, main: 2 of 28). A vector that was still missing after every writer had ended was seen once and twice in the two 200-scenario runs on JDK 25 and never on JDK 21. That last one could mean a lost index entry; I have not looked into it yet.
    • The graph rebuild contributes but is not all of it: raising the rebuild threshold to 1,000,000 mutations lowers the rate (63 of 200 scenarios on main became 16 of 100) but not to zero.
    • The engine logs one WARNING per recovery in these runs: LSMVectorIndex Recovered 1 vectors from in-memory index (page-parsed: N, in-memory: N+1). 1,212 and 1,222 lines in the two 200-scenario runs on JDK 25, none in the one-writer runs. I do not know yet whether it is a cause or a symptom.

    What I did not control: the runs shared the mini with other jobs at nice 19 and the load was not the same in each, so compare the rows by the yes or no of a miss, not as rates between JDKs (the rate rises with load, see the comment of 06:39Z).

    Next: upstream has an open PR on the same subject, ArcadeData/arcadedb#12087 ("a commit replay holds its vectors back from searches until its commit concludes"). I am building its head and running the same repro on both JDKs, and then I will file the engine issue with Repro.java and these numbers.

  12. 2 remaining items

  13. tae898 commented on Nov 21, 2026

    @tae898
    CollaboratorAuthor

    I traced the race to the engine's commit-to-search path in 26.11.1 (a3a5d12457, the engine the failing runs link), and it is the one that ArcadeData/arcadedb#12087 fixes. A vector's commit has two phases. In phase 1 the index replay hands out the vector id and publishes its location and its delta-buffer entry (LSMVectorIndex.put, persistVectorWithLocation); the pages become readable only in phase 2 (TransactionContext.commit2ndPhase). A graph rebuild takes its id snapshot (deltaSnapshotId = nextId.get() in buildGraphFromScratchExclusively), reads only published pages without a file lock, and at the end trims the delta buffer to vectorId >= deltaSnapshotId. A commit that sits between its two phases when the snapshot is taken is trimmed as already in the graph without having been read, and the next search misses it until a later rebuild reads the pages. As I read the test and rebuildGraphBeforeSearch, it hits this because its 300 to 500 vector index (below the 1,000 vector limit for background rebuilds) rebuilds synchronously on the searching thread once 100 changes are pending, while three other writers commit.

    The failing runs did not contain the fix: the scheduled run 43799876573 (attempt 1; the re-run passed) links engine 26.11.1, #11969 merged on 2026-11-17 and #12087 is still open (head de3fd1ac10). A second miss on the same day, in run 43863995512 on PR #410 (attempt 1; the re-run passed), came from the Linux Python 3.12 leg of the JVM wheel, a different wheel and platform, which fits the engine as the cause. Which exact sub-window loses the vector (the Recovered N vectors from in-memory index path of the rebuild, or the trim before it) is not established. On an idle laptop with 4 writers I got 0 misses in 8,600 committed inserts over 43 scenarios, although the Recovered line appeared 65 times. So a miss seems to need a commit thread that is slow between its two phases, which fits the dependence on load in the earlier loops; that is an inference, not traced to a line. Next: a deterministic Java repro that splits one commit between commit1stPhase and commit2ndPhase with a rebuild in between (on 26.11.1 and on the #12087 head), and a CI run on an engine snapshot that contains the fix. I am not changing the test: it checks the property an agent loop needs.

  14. tae898 commented on Nov 21, 2026

    @tae898
    CollaboratorAuthor

    Closing the loop on the trace in my last comment, with a repro that has no race to win: it splits one commit by hand between TransactionContext.commit1stPhase and commit2ndPhase (both public, the Raft path drives them the same way), runs a vector graph rebuild on another thread in between, and then searches for the vector.

    Engine Rounds with the committed vector missing from the search after the commit
    26.11.1 (a3a5d12457) 5 of 5 (rebuildBlockedByInFlightCommit=true each time; a later buildVectorGraphNow() finds it every time)
    head of ArcadeData/arcadedb#12087 (de3fd1ac10) 0 of 5

    So the miss follows from the order of the two phases alone, and the pull request closes it. This is one JDK (25.0.4.1 for the run; the engine of the second row was built with GraalVM 25.0.2's javac), and the earlier comments here have the 100-scenario runs on Temurin 21 and 25. I ran it on the mini in the JDK 25 image of the 26.11.1 build, with the engine jars of that image for the first row and ./mvnw -pl engine -am package of the pull request's head for the second.

    PhaseSplitRepro.java
    // Deterministic repro for ArcadeData/arcadedb-python#409 (the order is fixed by hand, so there is no race to win).
    // One commit is split by hand between its two phases (TransactionContext.commit1stPhase then commit2ndPhase, both public: the Raft path drives them
    // the same way), a vector-graph rebuild runs in between on another thread, then the vector is searched for. No race to win: the order is fixed.
    //
    // Expected on 26.11.1 (a3a5d12457): the search after commit2ndPhase does not return the vector (hypothesis, from the code: the rebuild takes its id
    // snapshot after the replay handed the id out, reads only published pages, trims the delta buffer below the snapshot). A later buildVectorGraphNow()
    // finds it again. With the head of ArcadeData/arcadedb#12087 (de3fd1ac10) the search must return it.
    //
    // Run (classpath: the engine jars of the release, e.g. ~/build-scratch/repro409/lib-rel/*; JDK 21 or 25):
    //   java -cp '/home/tk/build-scratch/repro409/lib-rel/*' PhaseSplitRepro.java /home/tk/build-scratch/pr409/tmp
    import com.arcadedb.database.Database;
    import com.arcadedb.database.DatabaseFactory;
    import com.arcadedb.database.DatabaseInternal;
    import com.arcadedb.database.Document;
    import com.arcadedb.database.RID;
    import com.arcadedb.database.Record;
    import com.arcadedb.database.TransactionContext;
    import com.arcadedb.index.IndexInternal;
    import com.arcadedb.index.TypeIndex;
    import com.arcadedb.index.vector.LSMVectorIndex;
    import com.arcadedb.schema.Schema;
    import com.arcadedb.schema.TypeLSMVectorIndexBuilder;
    import com.arcadedb.serializer.json.JSONObject;
    import com.arcadedb.utility.Pair;
    
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
    
    public class PhaseSplitRepro {
      static final int DIM = 8, BASE = 300, K = 5, EF = 400;
    
      static float[] vec(final int i) {
        final Random rnd = new Random(i);
        final float[] v = new float[DIM];
        double n = 0;
        for (int d = 0; d < DIM; d++) {
          v[d] = (float) (rnd.nextDouble() * 2 - 1);
          n += v[d] * v[d];
        }
        n = Math.sqrt(n);
        for (int d = 0; d < DIM; d++)
          v[d] /= n;
        return v;
      }
    
      /** The vids the search returns, nearest first (the binding's search: findNeighborsFromVector, hits loaded by RID). */
      static List<Integer> search(final Database db, final List<LSMVectorIndex> subs, final int vid) {
        final List<Integer> out = new ArrayList<>();
        for (final LSMVectorIndex lsm : subs) {
          try {
            for (final Pair<RID, Float> p : lsm.findNeighborsFromVector(vec(vid), K, EF)) {
              final Record r = db.lookupByRID(p.getFirst(), true);
              out.add(((Number) ((Document) r.asDocument()).get("vid")).intValue());
            }
          } catch (final Exception e) {
            out.add(-1); // a search that throws (RecordNotFoundException on an RID whose record is not readable yet) is a miss too
            System.out.println("  search threw " + e);
          }
        }
        return out;
      }
    
      public static void main(final String[] args) throws Exception {
        final Path dir = Files.createTempDirectory(Path.of(args[0]), "phasesplit-");
        final Database db = new DatabaseFactory(dir.resolve("db").toString()).create();
        try {
          db.command("sql", "CREATE VERTEX TYPE Doc");
          db.command("sql", "CREATE PROPERTY Doc.embedding ARRAY_OF_FLOATS");
          db.begin();
          for (int i = 0; i < BASE; i++)
            db.command("sql", "INSERT INTO Doc SET vid = ?, embedding = ?", i, vec(i));
          db.commit();
    
          final TypeLSMVectorIndexBuilder b = (TypeLSMVectorIndexBuilder) db.getSchema().buildTypeIndex("Doc", new String[] { "embedding" })
              .withType(Schema.INDEX_TYPE.LSM_VECTOR);
          b.withDimensions(DIM);
          b.withSimilarity("cosine");
          b.withMaxConnections(32);
          b.withBeamWidth(100);
          b.withQuantization("INT8");
          final JSONObject meta = new JSONObject();
          meta.put("addHierarchy", true);
          b.withMetadata(meta);
          final TypeIndex index = b.create();
          final List<LSMVectorIndex> subs = new ArrayList<>();
          for (final IndexInternal s : index.getSubIndexes())
            if (s instanceof LSMVectorIndex l)
              subs.add(l);
          for (final LSMVectorIndex l : subs)
            l.buildVectorGraphNow();
    
          int misses = 0;
          for (int round = 0; round < 5; round++) {
            final int vid = BASE + round;
            db.begin();
            db.command("sql", "INSERT INTO Doc SET vid = ?, embedding = ?", vid, vec(vid));
            final TransactionContext tx = ((DatabaseInternal) db).getTransaction();
            final TransactionContext.TransactionPhase1 phase1 = tx.commit1stPhase(true); // replay done: id, location and delta entry published; pages not
            final Thread rebuild = new Thread(() -> {
              for (final LSMVectorIndex l : subs)
                l.buildVectorGraphNow(); // reads the published pages only, between the two phases
            }, "rebuild-between-phases");
            rebuild.start();
            rebuild.join(30_000);
            final boolean rebuildBlocked = rebuild.isAlive();
            tx.commit2ndPhase(phase1); // pages published, the commit has returned
            if (rebuildBlocked)
              rebuild.join(30_000);
            final List<Integer> after = search(db, subs, vid);
            final boolean found = !after.isEmpty() && after.get(0) == vid;
            System.out.println("round " + round + " vid " + vid + ": rebuildBlockedByInFlightCommit=" + rebuildBlocked + " nearestAfterCommit=" + after
                + (found ? " FOUND" : " MISSED"));
            if (!found) {
              misses++;
              for (final LSMVectorIndex l : subs)
                l.buildVectorGraphNow();
              final List<Integer> healed = search(db, subs, vid);
              System.out.println("   after one more buildVectorGraphNow: " + healed + (!healed.isEmpty() && healed.get(0) == vid ? " FOUND" : " MISSED"));
            }
          }
          System.out.println("TOTALS rounds=5 missed=" + misses);
          System.exit(misses == 0 ? 0 : 1);
        } finally {
          db.drop();
        }
      }
    }
  15. tae898 commented on Nov 22, 2026

    @tae898
    CollaboratorAuthor

    One more occurrence, on another platform: tests/test_vector_read_your_writes.py::test_another_task_finds_the_vector_once_the_writing_task_has_committed_it failed on darwin/arm64 with Python 3.11 in run 45012007195 of #441, a dependency bump that changes no code. So this is not Windows only. I re-ran the failed job. The fix is still ArcadeData/arcadedb#12087, which is open.

  16. tae898 commented on Nov 22, 2026

    @tae898
    CollaboratorAuthor

    And a second one within hours, again on macOS: test_through_the_facade_another_task_finds_the_vector_once_the_writing_task_has_committed_it failed on darwin/arm64 with Python 3.14 in run 45038386138 of #396, which does not touch vectors. Re-running the failed job there too.

  17. tae898 commented on Nov 22, 2026

    @tae898
    CollaboratorAuthor

    A third occurrence today, once more on darwin/arm64: test_through_the_facade_another_task_finds_the_vector_once_the_writing_task_has_committed_it failed with RecordNotFoundException: Record #1:489 not found in run 45044368506 of #398, which does not touch vector indexes. It is the same race, and the macOS runner hits it often. I re-ran the failed job. The fix is still ArcadeData/arcadedb#12087, which is open.

  18. tae898 commented on Nov 22, 2026

    @tae898
    CollaboratorAuthor

    Another occurrence: the push run on main at df35a6a (run 45051780322) failed test_another_task_finds_the_vector_once_the_writing_task_has_committed_it in tests/test_vector_read_your_writes.py on Windows, Python 3.11, JVM wheel. The next two runs on main (076d6d5, 7eb22cc) were green. It is the same test as in the earlier occurrences here, so I linked it and closed the red-main issue that the workflow opened for it (#449).

  19. tae898 commented on Nov 23, 2026

    @tae898
    CollaboratorAuthor

    Another occurrence on Windows, Python 3.14, JVM wheel: the push run on main at 04c1c3e (run 45088615472) failed test_through_the_facade_another_task_finds_the_vector_once_the_writing_task_has_committed_it with ArcadeDBError: Vector search failed. It is the same test family as the earlier occurrences here. The run before and after it on main were green.

  20. tae898 commented on Nov 23, 2026

    @tae898
    CollaboratorAuthor

    Merged #463 (0d5ed2726e): the tests of tests/test_vector_read_your_writes.py now rerun their whole body, on a fresh database, at most twice, and only when the failure is one of the three signatures of this race (N of M committed vectors were not found, Vector search failed, and the Record #n:n not found that it wraps). Any other failure is raised at once, and a test that fails all three runs fails. This is not a fix: the race is in the engine and the fix is ArcadeData/arcadedb#12087, which is open and not in a release. It only stops the race from turning main red on about every other run, which was hiding other regressions.

    A rerun is visible: a UserWarning per rerun naming this issue, a flaky_race property on the test, and in the native parity harness a flaky_race=N count in the TOTAL row, a ::warning:: line per test and a block in the job summary. The assertions of the tests did not change.

    This issue stays open. The rerun and its counter are removed when the engine release that contains the fix is out and this file has passed 100 consecutive scheduled runs. The full tier has not run on the change yet; the first push run on main after the merge will be its first.

  21. tae898 commented on Nov 24, 2026

    @tae898
    CollaboratorAuthor

    Current state, 2026-11-24, from reading the upstream threads. I did not re-run anything for this comment.

    In my trace of 2026-11-21 I wrote that this is the race that ArcadeData/arcadedb#12087 fixes. That was incomplete. The upstream issue ArcadeData/arcadedb#11962 has two halves, in two pull requests. ArcadeData/arcadedb#11969 keeps in the delta the vectors that a graph build could not read, so a vector committed while a build runs is no longer missing from later searches. It was merged into main on 2026-11-17 (ccf6bd4fdc), so it is in the code of the 26.12.1 cut. The other half, a search in the window between the two commit phases that answers the in-flight record as an empty row, is ArcadeData/arcadedb#12087. It is still open, has no review, and no longer merges cleanly into main (GitHub reports it as dirty; the last push was 2026-11-20).

    What this means for the symptoms here: N of M committed vectors were not found is, by the description of #11969, the first half, so it may be gone with the 26.12.1 engine. I read Vector search failed and Record #n:n not found as the second half, but I have not matched them to the code. My repro rows of 2026-11-19 and 2026-11-21 compare 26.11.1 with the head of #12087, which has both halves, so they do not tell the two apart.

    What I have not done is run the Java repro on a build of main that has #11969 and not #12087. That row decides it, and it is the next step. Until it exists I do not know whether the 26.12.1 engine removes the miss, so the rerun of #463 stays and this issue stays open.

  22. tae898 commented on Nov 25, 2026

    @tae898
    CollaboratorAuthor

    Triage for 12-02: this does not block the release, and I propose to move it to 27.1.1. The miss is already in the published 26.11.1 wheels, so 26.12.1 does not introduce it, and the counted rerun of #463 keeps it from turning a run red. In the 8 parity jobs of the latest full native run on main I found no rerun. Upstream, ArcadeData/arcadedb#11969 was merged on 2026-11-17, and ArcadeData/arcadedb#12087 is still open, not mergeable as of its update of 2026-11-24. What is left: the Java repro on an engine build of main with the first and without the second, a decision on whether the user docs warn about the miss (a search for its issue and pull request numbers finds only the CI page), and removing the rerun after an engine release with the fix and 100 green scheduled runs, which cannot happen by 12-02. I have not changed the milestone.

  23. modified the milestones: 26.12.1, 27.1.1 on Nov 25, 2026
  24. tae898 commented on Nov 26, 2026

    @tae898
    CollaboratorAuthor

    The new head of ArcadeData/arcadedb#12087 (3d6fb7ccad) closes what is left of this race. A build of main without it, which already has ArcadeData/arcadedb#11969, no longer misses the committed vector in my repros, but a search can still be handed a record whose commit is not finished, and loading it fails with RecordNotFoundException. So I keep the rerun of #463. No action is needed.

    Fixed order, no race to win (one commit split by hand between its two phases, 5 rounds, the same result on JDK 21 and JDK 25 unless the cell says otherwise):

    engine a graph rebuild runs between the phases: committed vector missing afterwards a search runs between the phases: it returns the unfinished record, which fails to load a search runs between the phases: committed vector missing afterwards
    release 26.11.1 (a3a5d12457) 5 of 5 0 of 5 5 of 5
    main at 7298640353, without the pull request 0 of 5 5 of 5 0 of 5
    pull request head 3d6fb7ccad 0 of 5 0 of 5 0 of 5

    On 26.11.1 the search between the phases did not answer while the commit was open (still running after my 30 second wait in 5 of 5 rounds); on the other two engines it answered at once.

    With the race (4 writers, each searches for its vector right after its commit; JDK 21 and 25 together, 1,000 scenarios and 200,000 committed inserts per engine):

    engine committed vectors not found searches that threw RecordNotFoundException
    release 26.11.1 (a3a5d12457) 165 7
    main at 7298640353, without the pull request 0 8
    pull request head 3d6fb7ccad 0 0

    On the same laptop, in the same 1,000 scenarios, 26.11.1 did not find 165 vectors in the search right after their commit (all were found once the writers had ended); main missed none. On main, each of the 8 failed searches started after its own commit had returned, and its vector was in the database, so the record that failed to load is another one, which I read as another writer's commit in flight.

    What I infer for the bindings: with an engine cut from main as it was on 2026-11-25, the N of M committed vectors were not found failure of tests/test_vector_read_your_writes.py should be gone, and the Record #n:n not found and Vector search failed failures can still happen until that pull request is merged. It is still open. I will run this again on the first main build that contains it.

    Method, per-JDK counts, and the new repro

    My laptop (Core Ultra X9 388H), two E cores, the JVM sees 2 cpus, nice 0, Temurin 21.0.12 and 25.0.5, -Xmx3g. The engine jars of 7298640353 and 3d6fb7ccad were built with ./mvnw -pl engine -am -Dmaven.test.skip=true package on Temurin 21.0.12; 7298640353 is the merge base of the pull request, so the two builds differ only by its changes. Those two ran interleaved in 10 blocks of 50 scenarios per JDK. The 26.11.1 row is a control that I added after reading the first two, with the same programs and sizes on the published 26.11.1 jars. Repro.java and PhaseSplitRepro.java are the ones I posted earlier. These counts are not comparable with my earlier ones from another machine under load. The 26.11.1 scenarios took about 21 times as long as those on main, so read the race table as yes or no, not as rates.

    engine JDK scenarios scenarios with a failed search committed vectors not found search exceptions
    release 26.11.1 (a3a5d12457) 21.0.12 500 57 76 4
    release 26.11.1 (a3a5d12457) 25.0.5 500 72 89 3
    main at 7298640353, without the pull request 21.0.12 500 3 0 3
    main at 7298640353, without the pull request 25.0.5 500 5 0 5
    pull request head 3d6fb7ccad 21.0.12 500 0 0 0
    pull request head 3d6fb7ccad 25.0.5 500 0 0 0

    PhaseWindowSearchRepro.java:

    // Deterministic companion to PhaseSplitRepro.java for the second half of ArcadeData/arcadedb#11962 (a search between the two commit phases).
    // One commit is split by hand: TransactionContext.commit1stPhase, then a search on ANOTHER thread for the vector of the record that is still in
    // flight, then commit2ndPhase, then the same search again. No race to win: the order is fixed.
    //
    // Run (classpath: engine jar and its runtime dependencies): java -cp ... PhaseWindowSearchRepro.java <workdir>
    import com.arcadedb.database.Database;
    import com.arcadedb.database.DatabaseFactory;
    import com.arcadedb.database.DatabaseInternal;
    import com.arcadedb.database.Document;
    import com.arcadedb.database.RID;
    import com.arcadedb.database.Record;
    import com.arcadedb.database.TransactionContext;
    import com.arcadedb.index.IndexInternal;
    import com.arcadedb.index.TypeIndex;
    import com.arcadedb.index.vector.LSMVectorIndex;
    import com.arcadedb.query.sql.executor.ResultSet;
    import com.arcadedb.schema.Schema;
    import com.arcadedb.schema.TypeLSMVectorIndexBuilder;
    import com.arcadedb.serializer.json.JSONObject;
    import com.arcadedb.utility.Pair;
    
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
    
    public class PhaseWindowSearchRepro {
      static final int DIM = 8, BASE = 300, K = 5, EF = 400, ROUNDS = 5;
    
      static float[] vec(final int i) {
        final Random rnd = new Random(i);
        final float[] v = new float[DIM];
        double n = 0;
        for (int d = 0; d < DIM; d++) {
          v[d] = (float) (rnd.nextDouble() * 2 - 1);
          n += v[d] * v[d];
        }
        n = Math.sqrt(n);
        for (int d = 0; d < DIM; d++)
          v[d] /= n;
        return v;
      }
    
      /** What one search returned: the RIDs, and for each the vid of the loaded record or the exception of the load. */
      static final class Answer {
        final List<String> rows = new ArrayList<>();
        boolean answeredRid, loadFailed, searchThrew;
        boolean firstIsWanted;
      }
    
      static Answer search(final Database db, final List<LSMVectorIndex> subs, final int vid, final RID wanted) {
        final Answer a = new Answer();
        for (final LSMVectorIndex lsm : subs) {
          try {
            final List<Pair<RID, Float>> hits = lsm.findNeighborsFromVector(vec(vid), K, EF);
            for (int x = 0; x < hits.size(); x++) {
              final RID rid = hits.get(x).getFirst();
              final boolean isWanted = rid.equals(wanted);
              if (isWanted)
                a.answeredRid = true;
              try {
                final Record r = db.lookupByRID(rid, true);
                a.rows.add(rid + "=vid " + ((Document) r.asDocument()).get("vid"));
                if (x == 0 && isWanted)
                  a.firstIsWanted = true;
              } catch (final Exception e) {
                a.loadFailed = true;
                a.rows.add(rid + "=" + e.getClass().getSimpleName());
              }
            }
          } catch (final Exception e) {
            a.searchThrew = true;
            a.rows.add("search threw " + e.getClass().getSimpleName() + ": " + e.getMessage());
          }
        }
        return a;
      }
    
      public static void main(final String[] args) throws Exception {
        final Path dir = Files.createTempDirectory(Path.of(args[0]), "phasewindow-");
        final Database db = new DatabaseFactory(dir.resolve("db").toString()).create();
        int inFlightAnswered = 0, loadFailed = 0, threw = 0, blocked = 0, missedAfter = 0;
        try {
          db.command("sql", "CREATE VERTEX TYPE Doc");
          db.command("sql", "CREATE PROPERTY Doc.embedding ARRAY_OF_FLOATS");
          db.begin();
          for (int i = 0; i < BASE; i++)
            db.command("sql", "INSERT INTO Doc SET vid = ?, embedding = ?", i, vec(i));
          db.commit();
    
          final TypeLSMVectorIndexBuilder b = (TypeLSMVectorIndexBuilder) db.getSchema().buildTypeIndex("Doc", new String[] { "embedding" })
              .withType(Schema.INDEX_TYPE.LSM_VECTOR);
          b.withDimensions(DIM);
          b.withSimilarity("cosine");
          b.withMaxConnections(32);
          b.withBeamWidth(100);
          b.withQuantization("INT8");
          final JSONObject meta = new JSONObject();
          meta.put("addHierarchy", true);
          b.withMetadata(meta);
          final TypeIndex index = b.create();
          final List<LSMVectorIndex> subs = new ArrayList<>();
          for (final IndexInternal s : index.getSubIndexes())
            if (s instanceof LSMVectorIndex l)
              subs.add(l);
          for (final LSMVectorIndex l : subs)
            l.buildVectorGraphNow();
    
          for (int round = 0; round < ROUNDS; round++) {
            final int vid = BASE + round;
            db.begin();
            final RID rid;
            try (final ResultSet rs = db.command("sql", "INSERT INTO Doc SET vid = ?, embedding = ?", vid, vec(vid))) {
              rid = rs.next().getIdentity().get();
            }
            final TransactionContext tx = ((DatabaseInternal) db).getTransaction();
            final TransactionContext.TransactionPhase1 phase1 = tx.commit1stPhase(true); // index replay done, pages not yet published
            final Answer[] during = new Answer[1];
            final Thread reader = new Thread(() -> during[0] = search(db, subs, vid, rid), "search-between-phases");
            reader.start();
            reader.join(30_000);
            final boolean readerBlocked = reader.isAlive();
            tx.commit2ndPhase(phase1); // pages published, the commit has returned
            if (readerBlocked)
              reader.join(30_000);
            final Answer after = search(db, subs, vid, rid);
            final Answer d = during[0];
            if (readerBlocked)
              blocked++;
            if (d != null && d.answeredRid)
              inFlightAnswered++;
            if (d != null && d.loadFailed)
              loadFailed++;
            if (d != null && d.searchThrew)
              threw++;
            if (!after.firstIsWanted)
              missedAfter++;
            System.out.println("round " + round + " vid " + vid + " rid " + rid + ": searchBlockedByInFlightCommit=" + readerBlocked
                + " duringCommit_answeredInFlightRid=" + (d != null && d.answeredRid) + " duringCommit_loadFailed=" + (d != null && d.loadFailed)
                + " afterCommit_nearestIsTheRecord=" + after.firstIsWanted);
            System.out.println("   during: " + (d == null ? "no answer" : d.rows));
            System.out.println("   after:  " + after.rows);
          }
          System.out.println("TOTALS rounds=" + ROUNDS + " inFlightRidAnswered=" + inFlightAnswered + " loadFailed=" + loadFailed + " searchThrew=" + threw
              + " searchBlocked=" + blocked + " missedAfterCommit=" + missedAfter);
        } finally {
          db.drop();
        }
        System.out.println("DONE");
        Runtime.getRuntime().halt(0);
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugconcurrencygithub_actionsnativepythonvector

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions