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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.5.1
    • Component/s: None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Linked BF Score:
      42

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: