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

MozJSImplScope::kill() check for "correct thread" will always fail

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • 42

      This can cause a MaxTimeMS timeout that involves $where or a JavaScript function to return "Interrupted" rather than "MaxTimeMSExpired", causing our server_status_with_time_out_cursors.js concurrency test to fail sporadically.

      A quick fix for server_status_with_time_out_cursors.js is being made under SERVER-46225, which will add "Interrupted" to the accepted error list. This ticket will be used to fix the root cause and remove the quick fix.

      This is caused by the "_mr._thread.get_id() == stdx::this_thread::get_id()" comparison on the following conditional:

              if (_mr._thread.get_id() == stdx::this_thread::get_id() && _inOp > 0 && _opCtx) {
                  _killStatus = _opCtx->checkForInterruptNoAssert();
              }
      

      "_mr._thread" is never initialized, so the "id" it holds will never be equal to that of the current thread. Failing this check means we will not check the OperationContext for kill reason and substitute with a more generic "Interrupted" error code.

      The failing check is here: https://github.com/mongodb/mongo/blob/3f529eeb89a3821604012ea86e9ef7d6fb962a24/src/mongo/scripting/mozjs/implscope.cpp#L155-L159

            Assignee:
            james.wahlin@mongodb.com James Wahlin
            Reporter:
            james.wahlin@mongodb.com James Wahlin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: