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

Interrupted commands by maxTimeMS on mongos should propagate the error code to client

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.5
    • 2.5.3
    • MapReduce, Sharding
    • ALL

    Description

      Since drivers depend on the error code to throw exception for maxTimeMS timeout, interrupted commands on mongos should propagate the error code.

      The following commands have this issue.
      + aggregate. Wrong error code 17022, 50 is expected (known bug for javascript interruption error code).

      The others lack top-level error code.
      + count
      + mapreduce
      + text
      + moveChunk
      + collStats

      Commands output:

      ----
      Testing aggregate
      ----
       
      {
           "code" : 17022,
           "ok" : 0,
           "errmsg" : "exception: sharded pipeline failed on shard shard0001: { ok: 0.0, errmsg: \"operation exceeded time limit\", code: 50 }"
      }
       
      ----
      Testing count
      ----
       
      {
           "shards" : {
               
           },
           "cause" : {
                "ok" : 0,
                "errmsg" : "operation exceeded time limit",
                "code" : 50
           },
           "ok" : 0,
           "errmsg" : "failed on : shard0000"
      }
       
      ----
      Testing mapreduce
      ----
       
      {
           "ok" : 0,
           "errmsg" : "MR parallel processing failed: { ok: 0.0, errmsg: \"operation exceeded time limit\", code: 50 }"
      }
       
      ----
      Testing text
      ----
       
      {
           "rawresult" : {
                "ok" : 0,
                "errmsg" : "operation exceeded time limit",
                "code" : 50
           },
           "ok" : 0,
           "errmsg" : "failure on shard: shard0000:localhost:30000: errmsg: \"operation exceeded time limit\""
      }
       
      ----
      Testing moveChunk
      ----
      {
           "cause" : {
                "ok" : 0,
                "errmsg" : "operation exceeded time limit",
                "code" : 50
           },
           "ok" : 0,
           "errmsg" : "move failed"
      }
       
      ----
      Testing collStats
      ----
      {
           "sharded" : true,
           "ok" : 0,
           "errmsg" : "failed on shard: { ok: 0.0, errmsg: \"operation exceeded time limit\", code: 50 }"
      }

      For example, to reproduce this issue, running map-reduce against sharded collection with a small maxTimeMS gives the following error.

      mongos> var mapReduceArg = {
      ...     mapreduce: "foo",
      ...     map: function() { emit(this.i, 1); },
      ...     reduce: function(key, value) { return value.length },
      ...     out: { replace: "mapReduceOut" },
      ...     maxTimeMS: 10,
      ... };
      mongos> db.runCommand(mapReduceArg)
      {
      	"ok" : 0,
      	"errmsg" : "MR parallel processing failed: { errmsg: \"exception: JavaScript execution terminated\", code: 13475, ok: 0.0 }"
      }

      Attachments

        Activity

          People

            rassi J Rassi
            siyuan.zhou@mongodb.com Siyuan Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: