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

mongo shell fails to kill running operations on exit

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.11
    • Affects Version/s: 3.1.2
    • Component/s: Shell
    • None
    • Fully Compatible
    • ALL
    • Hide

      To see the assertion message from the server, start the mongod with log-level 1.

      > db.mycoll.drop();
      > db.mycoll.insert({});
      > db.mycoll.find({$where: "sleep(10000)"});
      ^C
      do you want to kill the current op(s) on the server? (y/n): y
      
      Server output
      2016-07-31T15:00:20.388-0400 I COMMAND  [conn6] command admin.$cmd command: currentOp { currentOp: 1 } keyUpdates:0 writeConflicts:0 numYields:0 reslen:935 locks:{} protocol:op_query 0ms
      2016-07-31T15:00:21.298-0400 D -        [conn6] User Assertion: 14:Expected field "op" to have numeric type, but found String
      2016-07-31T15:00:21.298-0400 D COMMAND  [conn6] assertion while executing command 'killOp' on database 'admin' with arguments '{ killOp: 1, op: "opid: 306" }' and metadata '{}': 14 Expected field "op" to have numeric type, but found String
      2016-07-31T15:00:21.298-0400 I COMMAND  [conn6] command admin.$cmd command: killOp { killOp: 1, op: "opid: 306" } keyUpdates:0 writeConflicts:0 exception: Expected field "op" to have numeric type, but found String code:14 numYields:0 reslen:118 locks:{} protocol:op_query 0ms
      
      Show
      To see the assertion message from the server, start the mongod with log-level 1. > db.mycoll.drop(); > db.mycoll.insert({}); > db.mycoll.find({$where: "sleep(10000)"}); ^C do you want to kill the current op(s) on the server? (y/n): y Server output 2016-07-31T15:00:20.388-0400 I COMMAND [conn6] command admin.$cmd command: currentOp { currentOp: 1 } keyUpdates:0 writeConflicts:0 numYields:0 reslen:935 locks:{} protocol:op_query 0ms 2016-07-31T15:00:21.298-0400 D - [conn6] User Assertion: 14:Expected field "op" to have numeric type, but found String 2016-07-31T15:00:21.298-0400 D COMMAND [conn6] assertion while executing command 'killOp' on database 'admin' with arguments '{ killOp: 1, op: "opid: 306" }' and metadata '{}': 14 Expected field "op" to have numeric type, but found String 2016-07-31T15:00:21.298-0400 I COMMAND [conn6] command admin.$cmd command: killOp { killOp: 1, op: "opid: 306" } keyUpdates:0 writeConflicts:0 exception: Expected field "op" to have numeric type, but found String code:14 numYields:0 reslen:118 locks:{} protocol:op_query 0ms
    • Query 18 (08/05/16)

      This is a regression to ConnectionRegistry::killOperationsOnAllConnections() introduced by the changes from SERVER-7775 with the addition of the "killOp" command: https://github.com/mongodb/mongo/commit/d6cd29d1fc0594657fcb2b69ce8334df85f9ba54#diff-629362cc5e412256e6879e87f489a3a6.

      In verisons of the mongo shell prior to 3.1.2, the arguments sent to the server were constructed using

      QUERY("op"<< op["opid"])
      // which expands to
      BSON("op"<< op["opid"])
      // which expands to
      (::mongo::BSONObjBuilder(64) << "op"<< op["opid"]).obj()
      
      // which makes the following chain of function calls
      BSONObjBuilder::BSONObjBuilder(int initsize);
      BSONObjBuilder::operator<<(StringData name);
      BSONObjBuilderValueStream::operator<<(const BSONElement& e);
      BSONObjBuilder::appendAs(const BSONElement& e, StringData fieldName);
      ...
      

      However, in versions of the mongo shell 3.1.2 and later, the arguments sent to the server were constructed using

      BSONObjBuilder::BSONObjBuilder(int initsize);
      BSONObjBuilder::append(StringData fieldName, const std::string& str);
      

      by implicitly calling BSONElement::operator std::string() and thus creating an object of the form {op: "opid: <opid>"} instead of {op: <opid>}.

            Assignee:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: