[SERVER-28665] More informative message when JS execution is interrupted Created: 07/Apr/17  Updated: 06/Dec/17  Resolved: 04/May/17

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: None
Fix Version/s: 3.5.7

Type: Improvement Priority: Minor - P4
Reporter: Kevin Pulo Assignee: Kevin Pulo
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

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

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



 Comments   
Comment by Githook User [ 04/May/17 ]

Author:

{u'username': u'devkev', u'name': u'Kevin Pulo', u'email': u'kevin.pulo@mongodb.com'}

Message: SERVER-28665 More informative message when JS execution is interrupted
Branch: master
https://github.com/mongodb/mongo/commit/4b76e2cd5a49a64d0ba9789d800b61de90032274

Generated at Thu Feb 08 04:18:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.