Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-81506

configureFailPoint failCommand closeConnection:true may override times:0 mode

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch
    • ALL

      While investigating CLOUDP-202309, I observed that configureFailPoint seems to ignore times: 0 when closeConnection: true is specified in the data field for the failCommand fail point.

      db = db.getSiblingDB('test');
      db.test.drop();
      db.createCollection('test', { writeConcern: { w: 'majority' }});
      
      db.adminCommand({
          configureFailPoint: 'failCommand',
          mode: { times: 0 },
          data: {
              failCommands: ['insert'],
              closeConnection: true,
          }
      });
      
      coll = db.test;
      
      try {
          coll.insertOne({ _id: 1 }, );
      } catch (e) {
          print(e);
      }
      
      print(coll.findOne());
      

      With closeConnection: true omitted, the fail point is never triggered and the document is successfully inserted. This seems incorrect, as I would expect the top-level mode parameter to take priority over any fail point-specific options under data.

      I ran this script using a local 7.0 replica set with retryable writes disabled (lest the insert succeed on a retry attempt):

      mongosh mongodb://127.0.0.1:27070/?retryWrites=false script.js
      

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: