[SERVER-58051] Mongod.exe does not release file handles on rotated logs on windows 10 Created: 24/Jun/21  Updated: 29/Oct/23  Resolved: 30/Jul/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.4.5, 4.4.6
Fix Version/s: 5.0.3, 4.4.9, 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Patrick Dawson Assignee: Sergey Galtsev (Inactive)
Resolution: Fixed Votes: 0
Labels: logging
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS: Windows 10 20H2


Attachments: PNG File mongo-not-release-file-handle-logrotation-1.png     JPEG File mongo-not-release-file-handle-logrotation.jpg    
Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0, v4.4
Steps To Reproduce:
  • Install mongodb community server version 4.4.x (tested with 4.4.0, 4.4.5, 4.4.6).
  • Issue command: db.adminCommand({ logRotate: 1 })
  • Check file handles for mongod process with resmon.exe (see screenshot)
Sprint: Security 2021-07-26, Security 2021-08-09
Participants:

 Description   

I found that mongod.exe does not release file handles to rotated log files beginning with mongo version 4.4.0. 

This is a problem because I am not able to delete old rotated logs any more with nodejs or any other tool that aquires file handles with SHARED flags.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 16/Aug/21 ]

Author:

{'name': 'sergey.galtsev', 'email': 'sergey.galtsev@mongodb.com', 'username': 'brushless-glitch'}

Message: SERVER-58051 close the original log when rotating to new
Branch: v5.0
https://github.com/mongodb/mongo/commit/d423ad12e4d2d2b242c2cf1f8c84d389869b5e13

Comment by Githook User [ 16/Aug/21 ]

Author:

{'name': 'sergey.galtsev', 'email': 'sergey.galtsev@mongodb.com', 'username': 'brushless-glitch'}

Message: SERVER-58051 close the original log when rotating to new
Branch: v4.4
https://github.com/mongodb/mongo/commit/0195e030346fe2986320107cede904b54727930d

Comment by Githook User [ 30/Jul/21 ]

Author:

{'name': 'sergey.galtsev', 'email': 'sergey.galtsev@mongodb.com', 'username': 'brushless-glitch'}

Message: SERVER-58051 close the original log when rotating to new
Branch: master
https://github.com/mongodb/mongo/commit/c0b5fa0957205eba75360f2daecde1aa121e1090

Comment by Sergey Galtsev (Inactive) [ 29/Jul/21 ]

https://mongodbcr.appspot.com/802830027/

Comment by Eric Sedor [ 01/Jul/21 ]

Hi patrick.soboljew@gmail.com, I wanted to let you know we can see the two screenshots you uploaded, and will take a look at this issue. Thanks!

Comment by Patrick Dawson [ 30/Jun/21 ]

It seems that my screenshots always get broken after upload. They show that the mongodb process still has handles on rotated files with (with resmon.exe). I cannot figure out what the problem with the screenshot upload is.

Comment by Patrick Dawson [ 24/Jun/21 ]

Just for clarification: this was not an issue in mongodb 3.6. I also tested 4.2.x an the handles were released on rotated logs in both versions. Only a file handle to file "mongo.log" was kept.

Generated at Thu Feb 08 05:43:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.