[SERVER-72441] Log an error message for remove() only when it's necessary Created: 29/Dec/22  Updated: 29/Oct/23  Resolved: 06/Jan/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Bug Priority: Minor - P4
Reporter: Kevin Cherkauer Assignee: Yoon Soo Kim
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 06/Jan/23 ]

Author:

{'name': 'Yoonsoo Kim', 'email': 'yoonsoo.kim@mongodb.com', 'username': 'yun-soo'}

Message: SERVER-72441 Log an error message for remove() only when it's necessary
Branch: master
https://github.com/mongodb/mongo/commit/206da68ef3b725bbc3a3b5555802f76f4ed0856d

Comment by Githook User [ 30/Dec/22 ]

Author:

{'name': 'Kevin Cherkauer', 'email': 'kevin.cherkauer@mongodb.com', 'username': 'kevin-cherkauer'}

Message: SERVER-72441 Named Pipes: Suppress misleading "error" message from SERVER-70970
Branch: master
https://github.com/mongodb/mongo/commit/d88e203be2a206ddb2de326f7ba1c970f50d084b

Comment by Kevin Cherkauer [ 29/Dec/22 ]

The failure should not be logged if the return code is ENOENT (which is 2 on my VWS, but we should use the symbolic name in case it is different on other platforms).

 

Generated at Thu Feb 08 06:21:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.