Skip to content

mongodb 7.6.0: insertOne after deleteMany rejects with "reading 'state'" and the process hangs #11460

Description

@proggeramlug

Found by the Phase 1 package benchmark harness (benchmarks/packages/mongodb/insert_find.ts, branch wip/pkg-bench-phase1). Reproduces on main 36420d2e56 (Linux x86-64, mongod 8.x, mongodb 7.6.0 compiled from source).

Sequential insertOne + findOne round trips work for hundreds of iterations, but after a deleteMany({}) on the same collection, the next insertOne rejects with Cannot read properties of undefined (reading 'state'), and the process then hangs (never exits) instead of finishing. The workload's shape (the numbers below are from the workload binary itself, not from this condensed snippet):

// npm i mongodb@7.6.0 ; mongod on 127.0.0.1:57017
import { MongoClient } from "mongodb";
const client = new MongoClient("mongodb://127.0.0.1:57017/?directConnection=true");
await client.connect();
const col = client.db("pkgbench").collection("items_if");
await col.deleteMany({});
const once = async (i: number) => {
  await col.insertOne({ _id: "d" + i, n: i } as any);
  return (await col.findOne({ _id: "d" + i } as any)) as any;
};
for (let i = 0; i < 200; i++) await once(i);   // "warm-up"
await col.deleteMany({});
for (let i = 0; i < 500; i++) await once(i);   // perry: rejects here
await col.drop(); await client.close();
console.log("done");

Measured with the workload binary (./mongodb__insert_find <n> <warm>):

args perry (main) node 26.5.1
500 0 (no warm-up, so no mid-run deleteMany) correct checksum, 12 s same checksum
500 200 ERROR Cannot read properties of undefined (reading 'state'), then no exit (killed at 120 s) correct
2000 200 no output, killed at 120 s correct

The companion workload mongodb/batch_query (insertMany + find().sort().project().toArray() + countDocuments, also with a mid-run deleteMany) runs correctly on the same server. Distinct from #11043 (reading 'default' on connect). The harness now skips this workload as a known hang (manifest known_hang).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions