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

RunOnAllShardsCommand() can receive an empty message, which currently causes an assertion failure

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.0.7, 2.2.0
    • Fix Version/s: None
    • Component/s: Sharding
    • Labels:
    • Operating System:
      ALL

      Description

      In RunOnAllShardsCommand::run() (parallel.cpp L144 in master), we check for an error response from each future:

          BSONObj result = res->result();
       
          if( ! result["errmsg"].eoo() ){
              errors.appendAs(res->result()["errmsg"], res->getServer());
          }

      In this code, we access the "errmsg" field in the result object without first checking that the result object is valid/non-empty. If a command fails, we end up with an invalid result object, then assert when trying to access the errmsg field (as it doesn't exist, and the object is likely empty/invalid anyway).

      Note that even if one server returns a bad response, this bug will cause all responses to fail, even if successfully executed on the remote server.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              benjamin.becker Ben Becker
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: