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

Repair with bind_ip results in a null pointer dereference

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0.6, 4.1.7
    • Affects Version/s: 4.0.3, 4.1.3
    • Component/s: Networking
    • Labels:
    • Fully Compatible
    • ALL
    • v4.0
    • Hide
      ./mongod --repair --bind_ip 0.0.0.0
      
      Show
      ./mongod --repair --bind_ip 0.0.0.0
    • Service Arch 2018-12-17, Service Arch 2018-12-31, Service Arch 2019-01-14

      The null pointer dereference: https://github.com/mongodb/mongo/blob/dc9e1ee045af74c74360ffce2bec88868b08e1dc/src/mongo/executor/network_interface_tl.cpp#L133-L134

      Also consider changing this test to examine the error code on a repair run:
      https://github.com/mongodb/mongo/blob/abb1b353648260175c3dfe02ac8ae54c083956f7/jstests/multiVersion/downgrade_to_36_only_with_recovered_data.js#L72-L76

      This patch would have surfaced the problem sooner, though I don't think anyone would reasonably pass in --bind_ip with --repair:

      diff --git a/jstests/multiVersion/downgrade_to_36_only_with_recovered_data.js b/jstests/multiVersion/downgrade_to_36_only_with_recovered_data.js
      index 87e816f629..99fadbd7ab 100644
      --- a/jstests/multiVersion/downgrade_to_36_only_with_recovered_data.js
      +++ b/jstests/multiVersion/downgrade_to_36_only_with_recovered_data.js
      @@ -25,6 +25,9 @@
           const name = "rs";
           let conn = MongoRunner.runMongod(
               {binVersion: "latest", shardsvr: "", replSet: name, syncdelay: "600"});
      +    let dbpath = conn.dbpath;
      +    let port = conn.port;
      +    printjson({"DBPath": dbpath, "Port": port});
       
           assert.neq(conn, null, "mongod was unable to start up");
       
      @@ -71,10 +74,17 @@
           MongoRunner.stopMongod(conn);
       
           jsTestLog("Running repair. The process will automatically exit when complete.");
      -    options.shardsvr = undefined;
      -    options.replSet = undefined;
      -    options.repair = '';
      -    MongoRunner.runMongod(options);
      +    // options.shardsvr = undefined;
      +    // options.replSet = undefined;
      +    // options.repair = '';
      +    // MongoRunner.runMongod(options);
      +
      +    // Fake a port because `runMongoProgram` thinks that is required.
      +    // --bind_ip 0.0.0.0 is necessary to reproduce crash
      +    assert.eq(
      +        0,
      +        runMongoProgram(
      +            "mongod", "--repair", "--dbpath", dbpath, "--port", port, "--bind_ip", "0.0.0.0"));
       
           jsTestLog("Restarting after repair with replication.");
           options.shardsvr = '';
      

            Assignee:
            mira.carey@mongodb.com Mira Carey
            Reporter:
            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: