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

Log an error message for remove() only when it's necessary

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL

      SERVER-70970 added logging of all failures of remove(pipeAbsolutePath) in named_pipe_posix.cpp, but most of the time of the ctor execution these are from attempts to remove a pipe that did not exist, which is the most common and expected behavior:

      > _writeTestPipe("one", 1000);
      {"t":\{"$date":"2022-12-29T20:25:15.397Z"},"s":"I",  "c":"TEST",
      "id":7097000, "ctx":"thread7","msg":"Failed to remove",
      "attr":\{"error":"Failed to remove /tmp/one: error code = 2, No such file or directory"}}
      

      This message should be suppressed in the case where the file did not exist in the ctor, else it makes it look like the _writeTestPipe() function failed in mongo shell, when actually it succeeded.

      Update:
      The log message level "s":"I" indicates that it's not an error but some users might think it's a real error since the log message has the error field. To avoid any possible confusion, it would be better to log an error message with ERROR level only in the dtor & all errors and the ctor & errors other than ENOENT error, but not in the ctor & ENOENT case. Otherwise, users may miss important error message which may be a clue about what went wrong.

            Assignee:
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Reporter:
            kevin.cherkauer@mongodb.com Kevin Cherkauer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: