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

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

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.7, 2.2.0
    • Component/s: Sharding
    • Labels:
    • ALL

      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.

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

              Created:
              Updated:
              Resolved: