[SERVER-17012] Server Terminates Javascript Execution for GroupStage Setup with a Timeout Created: 22/Jan/15  Updated: 18/Sep/15  Resolved: 26/Jan/15

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: None
Fix Version/s: 3.0.0-rc7

Type: Bug Priority: Major - P3
Reporter: Jonathan Balsano Assignee: Jonathan Balsano
Resolution: Done Votes: 0
Labels: 28qa, pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:
Linked BF Score: 0

 Description   

Build failures were observed in the concurrency workloads that result in the following error:

2015-01-15T13:28:25.142+0000 I QUERY    Error: 1 thread threw
        Error: command failed: {
        	"errmsg" : "exception: JavaScript execution terminated",
        	"code" : 16721,
        	"ok" : 0
        } : undefined
            at quietlyDoAssert (jstests/concurrency/fsm_libs/assert.js:53:15)
            at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
            at wrapAssertFn (jstests/concurrency/fsm_libs/assert.js:60:16)
            at Function.assertWithLevel.(anonymous function) [as commandWorked] (jstests/concurrency/fsm_libs/assert.js:99:13)
            at Object.group (jstests/concurrency/fsm_workloads/group_cond.js:29:27)
            at Object.runFSM [as run] (jstests/concurrency/fsm_libs/fsm.js:19:16)
            at <anonymous>:8:13
            at Object.main (jstests/concurrency/fsm_libs/worker_thread.js:68:17)
            at ____MongoToV8_newFunction_temp (<anonymous>:5:25)
            at ____MongoToV8_newFunction_temp (<anonymous>:3:24)
    at throwError (jstests/concurrency/fsm_libs/runner.js:261:23)
    at jstests/concurrency/fsm_libs/runner.js:390:17
    at Array.forEach (native)
    at runWorkloads (jstests/concurrency/fsm_libs/runner.js:345:22)
    at serial (jstests/concurrency/fsm_libs/runner.js:406:13)
    at /data/mci/shell/src/jstests/concurrency/fsm_all.js:27:1 at jstests/concurrency/fsm_libs/runner.js:273
failed to load: /data/mci/shell/src/jstests/concurrency/fsm_all.js

Builds that encountered this error include:

These seem to be caused by a javascript timeout that we've placed in multiple locations on our own code execution in db/exec/group.cpp:

        _scope->exec("$reduce = " + _request.reduceCode, "$group reduce setup", false, true, true,
        _scope->exec("$arr = [];", "$group reduce setup 2", false, true, true, 100);

Other calls to both exec() and invoke() do not seem to use this timeout. For example, in db/commands/mr.cpp

            ScriptingFunction init = _scope->createFunction(
                        "_emitCt = 0;"
                        "_keyCt = 0;"
                        "_dupCt = 0;"
                        "_redCt = 0;"
                        "if (typeof(_mrMap) === 'undefined') {"
                        "  _mrMap = {};"
                        "}");
            _scope->invoke(init, 0, 0, 0, true);

Note that in both examples we're not executing client code, we're executing our own server code. It would appear that it is likely that a garbage collection could cause the execution to take more than 100ms but there seems to be no reason to keep the timeout here.



 Comments   
Comment by Githook User [ 26/Jan/15 ]

Author:

{u'username': u'jrbalsano', u'name': u'Jonathan Balsano', u'email': u'jonathan.balsano@10gen.com'}

Message: SERVER-17012 Increase timeouts on group JS execution

Closes #915

Signed-off-by: Benety Goh <benety@mongodb.com>
(cherry picked from commit a6ddf1762548e641930288d77d8910c30bb7cbb4)
Branch: v3.0
https://github.com/mongodb/mongo/commit/5cd1ae2e84ad938070045064450537cd455fd1fa

Comment by Githook User [ 26/Jan/15 ]

Author:

{u'username': u'jrbalsano', u'name': u'Jonathan Balsano', u'email': u'jonathan.balsano@10gen.com'}

Message: SERVER-17012 Increase timeouts on group JS execution

Closes #915

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/a6ddf1762548e641930288d77d8910c30bb7cbb4

Generated at Thu Feb 08 03:43:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.