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

Windows does not support ASCII control characters in database names with directoryperdb

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Storage
    • Windows

      According to http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx Windows does not support ASCII control characters. This manifests when creating a database, with any storage engine and using directoryperdb, which contains an ASCII control character in its name.

      On mmapv1, this results in:

      2015-01-14T18:47:59.658+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:49624 #2 (1 connection now open)
      2015-01-14T18:47:59.662+0000 I -        [conn2] Assertion: 14043:create dir for db  caught exception exception: boost::filesystem::create_directory: The filename, directory name, or volume label syntax is incorrect: "db1\"
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\util\stacktrace_win.cpp(175)                                mongo::printStackTrace+0x43
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\util\log.cpp(135)                                           mongo::logContext+0xd7
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\util\assert_util.cpp(214)                                   mongo::msgasserted+0x114
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\util\assert_util.cpp(206)                                   mongo::msgasserted+0x1a
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\storage\mmap_v1\catalog\namespace_index.cpp(150)         `mongo::NamespaceIndex::maybeMkdir'::`1'::catch$0+0xef
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    f:\dd\vctools\crt\crtw32\eh\amd64\handlers.asm(51)                        _CallSettingFrame+0x20
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    f:\dd\vctools\crt\crtw32\eh\frame.cpp(1281)                               __CxxCallCatchBlock+0x162
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] ntdll.dll                                                                               RtlRestoreContext+0x2e2
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\storage\mmap_v1\catalog\namespace_index.cpp(150)         mongo::NamespaceIndex::maybeMkdir+0xe5
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\storage\mmap_v1\catalog\namespace_index.cpp(187)         mongo::NamespaceIndex::init+0x2cf
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\storage\mmap_v1\mmap_v1_database_catalog_entry.cpp(178)  mongo::MMAPV1DatabaseCatalogEntry::MMAPV1DatabaseCatalogEntry+0x1b5
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\storage\mmap_v1\mmap_v1_engine.cpp(266)                  mongo::MMAPV1Engine::getDatabaseCatalogEntry+0x522
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\catalog\database_holder.cpp(117)                         mongo::DatabaseHolder::openDb+0x229
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\client.cpp(313)                                          mongo::Client::Context::_finishInit+0x185
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\client.cpp(203)                                          mongo::Client::Context::Context+0x74
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(998)          mongo::WriteBatchExecutor::ExecInsertsState::_lockAndCheckImpl+0x390
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(1058)         mongo::insertOne+0xec
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(1092)         mongo::WriteBatchExecutor::execOneInsert+0x120
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(879)          mongo::WriteBatchExecutor::execInserts+0x175
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(760)          mongo::WriteBatchExecutor::bulkExecute+0x52
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(275)          mongo::WriteBatchExecutor::executeBatch+0x426
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\commands\write_commands\write_commands.cpp(146)          mongo::WriteCmd::run+0x178
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\dbcommands.cpp(1252)                                     mongo::_execCommand+0x72
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\dbcommands.cpp(1470)                                     mongo::Command::execCommand+0xf01
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\dbcommands.cpp(1545)                                     mongo::_runCommands+0x413
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\query\find.cpp(135)                                      mongo::runCommands+0x43
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\query\find.cpp(569)                                      mongo::runQuery+0x405
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\instance.cpp(212)                                        mongo::receivedQuery+0x2df
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\instance.cpp(395)                                        mongo::assembleResponse+0x36c
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\db\db.cpp(197)                                              mongo::MyMessageHandler::process+0xb6
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\mongo\util\net\message_server_port.cpp(227)                       mongo::PortMessageServer::handleIncomingMsg+0x670
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    ...\src\third_party\boost\libs\thread\src\win32\thread.cpp(185)           boost::`anonymous namespace'::thread_start_function+0x21
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    f:\dd\vctools\crt\crtw32\startup\threadex.c(376)                          _callthreadstartex+0x25
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] mongod.exe    f:\dd\vctools\crt\crtw32\startup\threadex.c(359)                          _threadstartex+0xe7
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] kernel32.dll                                                                            BaseThreadInitThunk+0xd
      2015-01-14T18:48:00.174+0000 I CONTROL  [conn2] 
      2015-01-14T18:48:00.175+0000 W STORAGE  [conn2] database db1  could not be opened due to DBException 14043: create dir for db  caught exception exception: boost::filesystem::create_directory: The filename, directory name, or volume label syntax is incorrect: "db1\"
      2015-01-14T18:48:00.175+0000 I WRITE    [conn2] insert .col query: { _id: ObjectId('54b6b9dfccf71b60db56bfc9'), data: true } ninserted:0 keyUpdates:0 writeConflicts:0 exception: create dir for db  caught exception exception: boost::filesystem::create_directory: The filename, directory name, or volume label syntax is incorrect: "db1\" code:14043 numYields:0  513ms
      2015-01-14T18:48:00.175+0000 I COMMAND  [conn2] command .$cmd command: insert { insert: "col", documents: [ { _id: ObjectId('54b6b9dfccf71b60db56bfc9'), data: true } ], ordered: true, writeConcern: {} } keyUpdates:0 writeConflicts:0 numYields:0  reslen:258 513ms
      2015-01-14T18:48:02.213+0000 I NETWORK  [conn2] end connection 127.0.0.1:49624 (0 connections now open)
      

      On WiredTiger:

      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\util\stacktrace_win.cpp(175)                         mongo::printStackTrace+0x43
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\util\log.cpp(135)                                    mongo::logContext+0xd7
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\util\assert_util.cpp(214)                            mongo::msgasserted+0x114
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\util\assert_util.cpp(206)                            mongo::msgasserted+0x1a
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\catalog\database.cpp(69)                          mongo::massertNamespaceNotIndex+0x1cb
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\catalog\database.cpp(486)                         mongo::Database::createCollection+0x8f
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(1012)  mongo::WriteBatchExecutor::ExecInsertsState::_lockAndCheckImpl+0x4b4
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(1058)  mongo::insertOne+0xec
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(1092)  mongo::WriteBatchExecutor::execOneInsert+0x120
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(879)   mongo::WriteBatchExecutor::execInserts+0x175
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(760)   mongo::WriteBatchExecutor::bulkExecute+0x52
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\commands\write_commands\batch_executor.cpp(275)   mongo::WriteBatchExecutor::executeBatch+0x426
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\commands\write_commands\write_commands.cpp(146)   mongo::WriteCmd::run+0x178
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\dbcommands.cpp(1252)                              mongo::_execCommand+0x72
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\dbcommands.cpp(1470)                              mongo::Command::execCommand+0xf01
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\dbcommands.cpp(1545)                              mongo::_runCommands+0x413
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\query\find.cpp(135)                               mongo::runCommands+0x43
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\query\find.cpp(569)                               mongo::runQuery+0x405
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\instance.cpp(212)                                 mongo::receivedQuery+0x2df
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\instance.cpp(395)                                 mongo::assembleResponse+0x36c
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\db\db.cpp(197)                                       mongo::MyMessageHandler::process+0xb6
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\mongo\util\net\message_server_port.cpp(227)                mongo::PortMessageServer::handleIncomingMsg+0x670
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    ...\src\third_party\boost\libs\thread\src\win32\thread.cpp(185)    boost::`anonymous namespace'::thread_start_function+0x21
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    f:\dd\vctools\crt\crtw32\startup\threadex.c(376)                   _callthreadstartex+0x25
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] mongod.exe    f:\dd\vctools\crt\crtw32\startup\threadex.c(359)                   _threadstartex+0xe7
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] kernel32.dll                                                                     BaseThreadInitThunk+0xd
      2015-01-14T19:43:59.338+0000 I CONTROL  [conn1] 
      2015-01-14T19:43:59.339+0000 I WRITE    [conn1] insert $.col query: { _id: ObjectId('54b6c6fe63749edfcc25544b') } ninserted:0 keyUpdates:0 writeConflicts:0 exception: cannot do createCollection on namespace with a $ in it: $.col code:17320 numYields:0  499ms
      2015-01-14T19:43:59.339+0000 I COMMAND  [conn1] command $.$cmd command: insert { insert: "col", documents: [ { _id: ObjectId('54b6c6fe63749edfcc25544b') } ], ordered: true } keyUpdates:0 writeConflicts:0 numYields:0  reslen:161 499ms
      2015-01-14T19:46:19.093+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:49693 #2 (2 connections now open)
      2015-01-14T19:46:19.099+0000 E STORAGE  [conn2] error creating path db1\ boost::filesystem::create_directory: The filename, directory name, or volume label syntax is incorrect: "db1\"
      2015-01-14T19:46:19.099+0000 E NETWORK  [conn2] Uncaught std::exception: boost::filesystem::create_directory: The filename, directory name, or volume label syntax is incorrect: "db1\", terminating
      2015-01-14T19:46:19.099+0000 I CONTROL  [conn2] dbexit:  rc: 100
      

      To create these databases, use the attached unprintable_windows.cpp with the hex code of an unprintable ASCII control character.

        1. unprintable_windows.cpp
          1 kB
          Spencer Jackson

            Assignee:
            dan@mongodb.com Daniel Pasette (Inactive)
            Reporter:
            spencer.jackson@mongodb.com Spencer Jackson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: