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

More informative message when JS execution is interrupted

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.5.7
    • Affects Version/s: None
    • Component/s: JavaScript
    • Labels:
      None
    • Fully Compatible

      When server-side JavaScript execution is interrupted (eg. by killOp, shutdown or stepdown), the uassert message "Interrupted by the host" is returned to the client, eg:

      2017-04-07T13:03:53.855+1000 E QUERY    [thread1] Error: error: {
      	"ok" : 0,
      	"errmsg" : "Interrupted by the host",
      	"code" : 11601,
      	"codeName" : "Interrupted"
      } :
      _getErrorWithCode@src/mongo/shell/utils.js:25:13
      DBCommandCursor@src/mongo/shell/query.js:689:1
      DBQuery.prototype._exec@src/mongo/shell/query.js:118:28
      DBQuery.prototype.hasNext@src/mongo/shell/query.js:276:5
      DBCollection.prototype.findOne@src/mongo/shell/collection.js:289:10
      @(shell):1:1
      

      The code of 11601 (ErrorCodes::Interrupted) is generic (and used in several places), and the message itself "Interrupted by the host" is also quite generic. It would be better if it included some indication that it was specifically the JS interpreter which was interrupted, eg. "JavaScript execution interrupted by the host". (The logs do contain some references to JS and this message, but are only really useful at logLevel 1.)

      https://github.com/mongodb/mongo/blob/r3.5.5/src/mongo/scripting/mozjs/implscope.cpp#L218

          if (scope->_hasOutOfMemoryException) {
              scope->_status = Status(ErrorCodes::JSInterpreterFailure, "Out of memory");
          } else if (scope->isKillPending()) {
              scope->_status = Status(ErrorCodes::Interrupted, "Interrupted by the host");
          }
      

            Assignee:
            kevin.pulo@mongodb.com Kevin Pulo
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: