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

Windows stack trace is very slow

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 3.4.0-rc3
    • Diagnostics
    • None
    • Windows
    • Fully Compatible
    • Windows
    • Platforms 2016-10-31, Platforms 2016-11-21

    Description

      Stack traces on Windows take more than half a second, even on fast machines.

      You can see the delay in the timestamps in this sample output:

      Mon Aug 05 04:33:02.463 *** stack trace for unhandled exception:
      Mon Aug 05 04:33:03.340 dbclient_rs_test.exe  ...\src\mongo\client\dbclient_rs_test.cpp(197)                       `anonymous namespace'::UnitTest__AllNodesDown__ReadFromPrimary::_doTest+0x50

      This stack trace took 0.877 seconds to generate, which is basically forever for a 3.3 GHz CPU.

      The slow code is this line: src/mongo/util/stacktrace.cpp line 183:

              BOOL ret = SymInitialize(process, getSymbolSearchPath(process), TRUE);

      The TRUE parameter is "fInvadeProcess":
      http://msdn.microsoft.com/en-us/library/windows/desktop/ms681351%28v=vs.85%29.aspx

      fInvadeProcess [in]
       
          If this value is TRUE, enumerates the loaded modules for the process and effectively calls the SymLoadModule64 function for each module.

      The issue is that there are (on my machine) 33 DLLs mapped into the address space that mongod.exe is running in, and calling SymLoadModule64() for any of them is almost always a waste of time. Essentially every stack trace we print contains only locations in mongod.exe, so the time spent loading symbol information that will not be used is wasted.

      The code should instead call SymLoadModule64() for the running .exe file and print only the module name for any address that is not in that file.

      Attachments

        Activity

          People

            jonathan.reams@mongodb.com Jonathan Reams
            tad Tad Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: