From a9f625f82a1a479c11bf42e24e7e13cf038b6343 Mon Sep 17 00:00:00 2001 From: Aleksey Shakhmatov Date: Tue, 4 Aug 2026 00:41:03 +0300 Subject: [PATCH] tests/fuzz: listIndexes on a namespace the prefix never created is expected `crash-fuzz.js` aborted with "harness error: MongoServerError: ns not found" whenever the surviving prefix contained no write that created the collection -- a kill during the first in-flight command on a fresh log. `listIndexes` on a missing namespace is NamespaceNotFound, which is what real MongoDB answers too, so the server was right and the harness treated a legitimate state as its own failure. Worse, it aborted the run instead of verifying that state, which is exactly the state worth verifying. Reproduces with `--seed 1234 --rounds 60` and is why seeded runs were unusable; `--heavy` happened to miss it. Confirmed against the previous commit before changing anything, so it is the harness and not the engine. Both seeds now pass 60 cycles. --- tests/fuzz/crash-fuzz.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/fuzz/crash-fuzz.js b/tests/fuzz/crash-fuzz.js index 5b1884b..7c27d68 100644 --- a/tests/fuzz/crash-fuzz.js +++ b/tests/fuzz/crash-fuzz.js @@ -498,7 +498,16 @@ async function verify(client, base, r, cycleNo) { const coll = db.collection('c'); const dbDocs = await coll.find({}, { sort: { _id: 1 } }).toArray(); const dbMap = new Map(dbDocs.map((d) => [d._id, d])); - const dbIndexes = await coll.indexes(); + // `listIndexes` on a namespace that does not exist is NamespaceNotFound, which + // is what real MongoDB answers too -- and it is the *expected* state whenever + // the surviving prefix contains no write that created the collection (a kill + // during the first in-flight command on a fresh log). Treating it as a harness + // error made any seed whose first cycle crashed at prefix 0 abort the run + // instead of verifying it, which is exactly the case worth verifying. + const dbIndexes = await coll.indexes().catch((e) => { + if (e.code === 26 || /ns not found|NamespaceNotFound/i.test(e.message)) return []; + throw e; + }); const indexExists = dbIndexes.some((i) => i.name === 'k_1'); if (VERBOSE) { console.log(` [verify] indexes=${JSON.stringify(dbIndexes.map((i) => i.name))} baseIdx=${base.indexCreated} idxPos=${r.idxPos}`);