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

db.shutdownServer() does not work as expected when mongod is a Windows Service

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.0.6, 2.2.0-rc1, 3.4.0
    • 3.4.3, 3.5.3
    • Admin
    • Windows Server 2008 R2 Enterprise
    • Fully Compatible
    • Windows
    • v3.4
    • Platforms 2017-02-13

    Description

      Since the correct way to shutdown a service (net stop mongodb) does not work as expected in 2.0.6, I have attempted to use db.shutdownServer. This unfortionately does not work as expected. Since mongod installs itself with service failure actions to restart the service (love how it does this!), when mongo is shutdown using the shell, Windows seems to think that mongod has exited without the service being shut down, which causes it to automatically restart the service. Sample mongo shell output:

      -------------------------------------
      SECONDARY> db.serverStatus().uptime
      531
      SECONDARY> use admin
      switched to db admin
      SECONDARY> db.shutdownServer()
      Mon Jun 11 11:07:09 DBClientCursor::init call() failed
      Mon Jun 11 11:07:09 query failed : admin.$cmd

      { shutdown: 1.0 }

      to: 127.0.0.1
      server should be down...
      Mon Jun 11 11:07:09 trying reconnect to 127.0.0.1
      Mon Jun 11 11:07:10 reconnect 127.0.0.1 ok
      SECONDARY> db.serverStatus().uptime
      4
      -------------------------------------

      Attachments

        Issue Links

          Activity

            People

              mark.benvenuto@mongodb.com Mark Benvenuto
              rhoffman Ryan Hoffman
              Votes:
              9 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: