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

Fix possible race in failWithErrorCodeInRuncommand failpoint

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.4
    • Affects Version/s: None
    • Component/s: Replication
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Repl 2020-02-24

      The way that the failWithErrorCodeInRunCommand failpoint is currently implemented is possibly racey.

      The check against shouldFail only indicates the failpoint was active at that particular instant and it is possible that the failpoint gets turned off immediately after, meaning the following call to 'getData' will fassert.

      We should instead do something along the lines of

      if (MONGO_UNLIKELY(failWithErrorCodeInRunCommand.scopedIf([&](const BSONObj& data){
        return data.hasField(...) ...;
      }.isActive())) {
        // build error reply.
      }
      

            Assignee:
            jason.chan@mongodb.com Jason Chan
            Reporter:
            jason.chan@mongodb.com Jason Chan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: