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

Mongod segfaults during teardown after javascript test failure

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: JavaScript
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      (function() {
          "use strict";
       
          TestData.disableImplicitSessions = true;
       
          const collName = "coll";
          const coll = db.getCollection(collName);
          coll.drop();
          for (let i = 0; i < 200; i++) {
              assert.commandWorked(coll.insert({x: 1}));
          }
       
          const cmdRes = db.runCommand({find: collName, filter: 
              { $where:  function() { sleep(100); return true; }}, batchSize: 0});
          assert.commandWorked(cmdRes);
          const cmdStr = 'db.runCommand({getMore: ' + cmdRes.cursor.id.toString() 
              + ', collection: "' + collName + '"})';
          const awaitShell = startParallelShell(cmdStr);
       
          assert.soon(function() {
              const currOp = db.currentOp( { "op": "getmore"});
       
              assert("inprog" in currOp);
              if (currOp.inprog.length === 0) {
                  return false;
              }
       
              const getmoreOp = currOp.inprog[0];
              assert.eq(("not-in-obj" in getmoreOp.cursor), true,
                  "this should error");
       
              db.killOp(getmoreOp.opid);
       
              return true;
          });
          awaitShell();
      }());
      
      

      Show
      (function() { "use strict";   TestData.disableImplicitSessions = true;   const collName = "coll"; const coll = db.getCollection(collName); coll.drop(); for (let i = 0; i < 200; i++) { assert.commandWorked(coll.insert({x: 1})); }   const cmdRes = db.runCommand({find: collName, filter: { $where: function() { sleep(100); return true; }}, batchSize: 0}); assert.commandWorked(cmdRes); const cmdStr = 'db.runCommand({getMore: ' + cmdRes.cursor.id.toString() + ', collection: "' + collName + '"})'; const awaitShell = startParallelShell(cmdStr);   assert.soon(function() { const currOp = db.currentOp( { "op": "getmore"});   assert("inprog" in currOp); if (currOp.inprog.length === 0) { return false; }   const getmoreOp = currOp.inprog[0]; assert.eq(("not-in-obj" in getmoreOp.cursor), true, "this should error");   db.killOp(getmoreOp.opid);   return true; }); awaitShell(); }());
    • Sprint:
      Security 2019-01-14, Dev Tools 2019-02-25, Dev Tools 2019-03-11

      Description

      After the test (attached in steps to reproduce) fails during the assert.soon, mongod segfaults during shutdown.

      [js_test:job0_fixture_teardown] 2018-12-18T11:19:53.087-0500 Starting the teardown of MongoDFixture (Job #0).
      [MongoDFixture:job0] Stopping mongod on port 20000 with pid 10085...
      [MongoDFixture:job0] 2018-12-18T11:19:53.088-0500 I CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
      [MongoDFixture:job0] 2018-12-18T11:19:53.088-0500 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
      [MongoDFixture:job0] 2018-12-18T11:19:53.088-0500 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-20000.sock
      [MongoDFixture:job0] 2018-12-18T11:19:53.088-0500 F -        [signalProcessingThread] Invalid access at address: 0x8
      [MongoDFixture:job0] 2018-12-18T11:19:53.105-0500 F -        [signalProcessingThread] Got signal: 11 (Segmentation fault).
      

      Here is the stacktrace:

       /home/vlad/github/mongo/src/mongo/util/stacktrace_posix.cpp:175:30: mongo::printStackTrace(std::ostream&)
       /home/vlad/github/mongo/src/mongo/util/signal_handlers_synchronous.cpp:182:5: printSignalAndBacktrace
       /home/vlad/github/mongo/src/mongo/util/signal_handlers_synchronous.cpp:281:0: mongo::(anonymous namespace)::abruptQuitWithAddrSignal(int, siginfo_t*, void*)
       /home/vlad/github/mongo/src/third_party/mozjs-45/extract/js/src/asmjs/AsmJSSignalHandlers.cpp:1159:9: AsmJSFaultHandler(int, siginfo_t*, void*)
       ??:0:0: ??
       /home/vlad/github/mongo/src/mongo/scripting/mozjs/implscope.cpp:210:27: mongo::mozjs::MozJSImplScope::kill()
       /home/vlad/github/mongo/src/mongo/scripting/mozjs/engine.cpp:124:9: mongo::mozjs::MozJSScriptEngine::interruptAll()
       /home/vlad/github/mongo/src/mongo/db/service_context.cpp:294:13: mongo::ServiceContext::setKillAllOperations()
       /home/vlad/github/mongo/src/mongo/db/db.cpp:922:5: mongo::(anonymous namespace)::shutdownTask()
       /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/functional:2267:14: operator()
       /home/vlad/github/mongo/src/mongo/util/exit.cpp:63:0: mongo::(anonymous namespace)::runTasks(std::stack<std::function<void ()>, std::deque<std::function<void ()>, std::allocator<std::function<void ()> > > >)
       /home/vlad/github/mongo/src/mongo/util/exit.cpp:142:5: mongo::shutdown(mongo::ExitCode)
       /home/vlad/github/mongo/src/mongo/util/exit.h:83:5: mongo::exitCleanly(mongo::ExitCode)
       /home/vlad/github/mongo/src/mongo/util/signal_handlers.cpp:200:17: mongo::(anonymous namespace)::signalProcessingThread(mongo::LogFileStatus)
       ??:0:0: ??
       ??:0:0: start_thread
       /build/glibc-Cl5G7W/glibc-2.23/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:109:0: clone
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: