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

Mongo crashes in windows if database name is a reserved file name

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.1.2
    • 2.0.1
    • Storage
    • None
    • Windows
    • Windows

    Description

      • Repro

      Pretty easy to reproduce:

      Example:
      in any mongo shell
      > use Aux
      > show collections

      mongod process crashes leaving this log:

      Mon Oct 24 20:11:16 [conn1] ERROR: Uncaught std::exception:
      boost::filesystem::file_size: The system cannot find the file
      specified: "e:\dat
      a\mongodb\Aux.ns", terminating
      Mon Oct 24 20:11:16 dbexit:
      Mon Oct 24 20:11:16 [conn1] shutdown: going to close listening
      sockets...
      Mon Oct 24 20:11:16 [conn1] closing listening socket: 436
      Mon Oct 24 20:11:16 [conn1] closing listening socket: 440
      Mon Oct 24 20:11:16 [initandlisten] now exiting
      Mon Oct 24 20:11:16 [conn1] shutdown: going to flush diaglog...
      Mon Oct 24 20:11:16 dbexit: ; exiting immediately
      Mon Oct 24 20:11:16 [conn1] shutdown: going to close sockets...

      The problem comes from an old legacy limitation of Windows, there are
      some file names/directories which are reserved and cannot be used.

      The list can be found here :
      http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

      (quote
      "CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8,
      COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also
      avoid these names followed immediately by an extension; for example,
      NUL.txt is not recommended. "

      What happens is mongo is trying to create an Aux.ns file, the API used
      does not create it, and mongo crashes the first time it tries to
      access the underlying file.

      I don't know what would be the best fix. Escaping the problematic
      names would be necessary, but then it could mess with compatibility
      with old backups made on unix systems.

      Attachments

        Activity

          People

            tad Tad Marshall
            yschwartz Yann Schwartz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: