[SERVER-6894] RunOnAllShardsCommand() can receive an empty message, which currently causes an assertion failure Created: 29/Aug/12  Updated: 06/Nov/12  Resolved: 30/Aug/12

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.0.7, 2.2.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ben Becker Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: commands, sharding
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-6441 Assertion failure in bsonobjbuilder.h Closed
Operating System: ALL
Participants:

 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.


Generated at Thu Feb 08 03:13:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.