ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • ALL
    • Storage Execution 2026-12-21
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      A replica set member running 8.0.29 aborted on invariant(isVersionInitialized()) in the IndexBuildsCoordinatorMongod thread. This happened when it was shut down shortly after restarting on data left behind by an interrupted logical initial sync. The index build failure path checks a feature flag against the FCV before the FCV has been initialized.

      Found by fault-injection testing (Antithesis) of a MongoDB-based system (Monarch, standby clusters). We can't share the environment itself; the details and a generic reproduction are below.

      Fatal line and backtrace

      "s":"F","c":"ASSERT","id":23079,"ctx":"IndexBuildsCoordinatorMongod-0","msg":"Invariant failure",
      "attr":{"expr":"isVersionInitialized()","file":"src/mongo/db/server_options.h","line":209}
      

      Symbolised frames (top of stack first, abort/print frames omitted):

      mongo::FeatureFlag::isEnabled(mongo::ServerGlobalParams::FCVSnapshot) const [clone .cold]
      mongo::IndexBuildState::_checkIfValidTransition(State, State) const
      mongo::IndexBuildState::setState(State, bool, boost::optional<Timestamp>, boost::optional<Status>)
      mongo::ReplIndexBuildState::setPostFailureState(mongo::Status const&)
      mongo::ThreadPool::Impl::_doOneTask(...)
      mongo::ThreadPool::Impl::_consumeTasks()
      mongo::ThreadPool::Impl::_workerThreadBody(...)
      

      Sequence observed

      Three-member replica set, keyFile auth, --wiredTigerCacheSizeGB 0.25, a workload continuously inserting into a collection with a secondary index (len_1) and creating it.

      1. The member (whose data had been wiped) was in logical initial sync, cloning the config database, with an index build in progress on a user collection.
      2. It received shutdown with {force: true, timeoutSecs: 0}. The log shows "Initial sync attempt failed" / "Initial Sync has been cancelled", "Index build: failed", and "Index build: aborted without cleanup" (with a buildUUID, on the user collection). mongod then exited cleanly with exit code 0.
      3. About 7 s later mongod was restarted on the same dbpath. It began answering hello about 0.3 s after starting.
      4. About 0.1 s after that, while still starting up, it received shutdown with {force: true, timeoutSecs: 0} again.
      5. About 0.15 s later it aborted (signal 6) with the invariant above. The failing index build's post-failure state transition consults a feature flag while the FCV is still uninitialized: either the member has restarted initial sync and hasn't cloned admin.system.version yet, or FCV initialization hasn't run yet.

      Generic reproduction (suggested; not yet run outside the fault-injection environment)

      1. Start a 3-node replica set on 8.0.29 and create a collection with a few secondary indexes and enough data (for example, a few hundred MB) that cloning takes several seconds. Keep a write workload running that occasionally runs createIndexes on that collection.
      2. Wipe one secondary's dbpath and restart it so it performs logical initial sync. Optionally slow cloning with the initialSyncHangBeforeCopyingDatabases / initialSyncHangDuringCollectionClone failpoints so an index build is in progress.
      3. While cloning, with an index build in progress on that member, run db.adminCommand({shutdown: 1, force: true, timeoutSecs: 0}) on it.
      4. Restart mongod on the same dbpath, then as soon as it accepts connections (before initial sync clones the admin database / the FCV is set) run the same forced shutdown again.
      5. Expect: a clean shutdown. Observed: Invariant failure isVersionInitialized() from IndexBuildsCoordinatorMongod, via ReplIndexBuildState::setPostFailureState.

      The narrow part is step 4: the shutdown must fail an index build before FCV initialization. A failpoint pausing startup or initial sync before the admin database is cloned should make it reliable.

      Related

      • SERVER-125978: same trigger (initial sync interrupted with an index build left behind), different invariant (buildUUID during FCV initialization). Fixed on master only.
      • SERVER-104892: the same isVersionInitialized() invariant, but in the shutdown task rather than the index-build state machine.
      • SERVER-49775 / SERVER-55319: earlier uninitialized-FCV checks reached from index builds.

      Impact

      The mongod aborts during startup and shutdown. In our environment the node was restarted and recovered, so no data was lost, but the abort is unexpected and shows up as a crash in fault-injection runs.

            Assignee:
            Matt Kneiser
            Reporter:
            Matt Broadstone
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: