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

Ensure stacktraces are logged from the `mongo` shell

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Server Security
    • ALL

      Currently, if a stacktrace should be emitted from the mongo shell (i.e. user uses "printStackTrace"; an invariant fails, etc), nothing is emitted to the log.

      I think this is because stacktraces are logged with severity Log() (https://github.com/mongodb/mongo/blob/8fd187d1f0c32a4d2fbf720e7f8c37b392c013b2/src/mongo/util/stacktrace.cpp#L103) to a backend that has filter for threshold Log (https://github.com/mongodb/mongo/blob/8fd187d1f0c32a4d2fbf720e7f8c37b392c013b2/src/mongo/logv2/log_domain_global.cpp#L205) , but the Shell uses LogSeverity::Info as the minimum severity it logs when not in verbose mode (https://github.com/mongodb/mongo/blob/fc021de4af28a6171e0eea8f5311268c5491876a/src/mongo/shell/shell_options.cpp#L117-L122) . Since "Info" is more severe than "Log", this means stacktraces are not logged when crashes happen / invariants fail in the shell.

            Assignee:
            backlog-server-security Backlog - Security Team
            Reporter:
            george.wangensteen@mongodb.com George Wangensteen
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: