[SERVER-46882] MongoDB keeps deleted log files open after rotation Created: 16/Mar/20  Updated: 02/Jun/20  Resolved: 17/Mar/20

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: 3.6.5
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: 興旺 莊 Assignee: Unassigned
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RHEL 7.x Linux x64, MongoDB 3.6.5 Community, Sharded Cluster


Attachments: PNG File lsof deleted 1.png     PNG File lsof deleted 2.png    
Participants:

 Description   

I made a script to rotate the logs every day, but my log files remain open after the rotation (see attachment).

Even if I restart the mongod processes, this problem will appear in the next few days.

Is there a problem with my script? Or the "kill -SIGUSR1 <pid>" command cannot be used when MongoDB is balancing? 

Any suggestions or root cause guessing?

Thanks~

$ crontab -l
==========================
05 00 * * * /opt/log_bk.sh

 

$ cat /opt/log_bk.sh
==========================
#!/bin/sh
/bin/kill -SIGUSR1 `cat /opt/foo/conf/SB/SB11.pid 2> /dev/null` 2> /dev/null || true
mv /opt/foo/logs/SB/SB11.log.* /opt/foo/logsbk/SB
compress /opt/foo/logsbk/SB/SB11.log.*

/bin/kill -SIGUSR1 `cat /opt/foo/conf/SB/SB31.pid 2> /dev/null` 2> /dev/null || true
mv /opt/foo/logs/SB/SB31.log.* /opt/foo/logsbk/SB
compress /opt/foo/logsbk/SB/SB31.log.*

find /opt/foo/logsbk/SB/ -type f -name "*.Z" -mtime +7 -exec rm -rf {} \;

 

 

 

 

 



 Comments   
Comment by Githook User [ 02/Jun/20 ]

Author:

{'name': 'vrachev', 'email': 'vlad.rachev@mongodb.com', 'username': 'vrachev'}

Message: SERVER-46882 Reuse debugger process for processes of same type in hang_analyzer.py
Branch: master
https://github.com/mongodb/mongo/commit/9fcca8acb9a8995e007b5c4c06e5349a57e274e6

Comment by Carl Champain (Inactive) [ 17/Mar/20 ]

Hi seth.chuang@thinkpower-info.com,

The SERVER project is for bugs and feature suggestions for the MongoDB server. As this ticket does not appear to be a bug, I will now close it. If you need assistance troubleshooting, I encourage you to ask our community by posting on the MongoDB Community Forums or on Stack Overflow with the mongodb tag.

Kind regards,
Carl

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