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

ServiceContextMongoDTest doesn't persist TempDir correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.3, 4.1.2
    • Component/s: Internal Code
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Platforms 2018-08-13

      Description

      In ServiceContextMongoDTest::ServiceContextMongoDTest(), it puts a unittest::TempDir on the stack. This seems unintentional, as the code immediately removes the temporary directory when the constructor finishes.
      The code still "works" on Linux because the storage engine has already opened all the files it needs by that point, so it never notices the directory got deleted.
      On Windows, the tests are working because the removal of the temp directory fails, since there are still open files in the directory. This results in any unit test utilizing ServiceContextMongoDTest on Windows to have their logs filled with copious warnings:

      [cpp_unit_test:lock_manager_test] 2018-07-27T07:26:08.819+0000 Starting C++ unit test build\cached\mongo\db\concurrency\lock_manager_test.exe...
      ...
      [cpp_unit_test:lock_manager_test] 2018-07-27T07:26:09.701+0000 2018-07-27T07:26:09.702+0000 W -        [main] error encountered recursively deleting directory 'C:\data\tmp\service_context_d_test_fixture-a59a-a817-07f1-c6e4': boost::filesystem::remove: The process cannot access the file because it is being used by another process: "C:\data\tmp\service_context_d_test_fixture-a59a-a817-07f1-c6e4\mongod.lock". Ignoring and continuing.
      ...
      
      

      (And I believe the test ends up littering the Windows test machines with many temp directories.)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: