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

Shell's implementation of ls attempts to call stat on symlinks

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • Fully Compatible
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Mongo shell shutdown calls ls. The shell's implementation of ls calls listFiles, which calls file_size on every file in the directory, which throws a boost filesystem exception on symlinks, which are immediately caught.

      SERVER-98918 overwrote __cxa_throw with a custom implementation to print a stack trace which appears to be slower than original. Engineers may have many symlinks in their mongo/ directory due to use of db-contrib-tool. This results in shell shutdown when running resmoke locally taking a long time and printing this error: 

      [js_test:profile_count:ValidateCollections] {"t":{"$date":"2025-02-06T21:16:20.449Z"},"s":"W",  "c":"CONTROL",  "id":9891800, "ctx":"main","msg":"Threw exception","attr":{"type":"N5boost10filesystem16filesystem_errorE"}} 

      many times on shutdown.

      The boost docs indicate that file_size should only be called on files which exist and are regular files.

            Assignee:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None