[SERVER-11438] server aborts if original log file is moved before rotating log Created: 29/Oct/13  Updated: 29/Oct/13  Resolved: 29/Oct/13

Status: Closed
Project: Core Server
Component/s: Logging, Stability
Affects Version/s: 2.4.7
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Justin Lintz Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: crash
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 10.04 64 bit


Issue Links:
Duplicate
duplicates SERVER-11087 mongod/mongos fatally asserts when ro... Backlog
Operating System: Linux
Steps To Reproduce:

Configure logrotate with a configuration such as

/var/log/mongodb/mongodb.log {
daily
dateext
missingok
rotate 60
compress
delaycompress
notifempty
nocreate
sharedscripts
postrotate
[ ! -f /mongo/db/mongod.lock ] || kill -USR1 `cat /mongo/db/mongod.lock`
endscript
}

Run logrotate, mongodb.log file will get moved by logrotate, SIGUSR1 is sent expecting mongodb.log to exist but it's already been rotated.

Tue Oct 29 06:37:33.009 ERROR: failed to rename '/var/log/mongodb/mongodb.log' to '/var/log/mongodb/mongodb.log.2013-10-29T10-37-33': errno:2 No such file or directory
Tue Oct 29 06:37:33.019 Fatal Assertion 16782
0xde0151 0xd9ff43 0x6cf530 0xe289d9 0x7f631dbe09ca 0x7f631cf8721d
/usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0xde0151]
/usr/bin/mongod(_ZN5mongo13fassertFailedEi+0xa3) [0xd9ff43]
/usr/bin/mongod(_ZN5mongo22signalProcessingThreadEv+0xe0) [0x6cf530]
/usr/bin/mongod() [0xe289d9]
/lib/libpthread.so.0(+0x69ca) [0x7f631dbe09ca]
/lib/libc.so.6(clone+0x6d) [0x7f631cf8721d]

Participants:

 Description   

Mongodb segfaults expecting mongodb.log to exist during logrotate



 Comments   
Comment by Eric Milkie [ 29/Oct/13 ]

That does not appear to be a segmentation fault – rather, it is an error that causes the server to exit rather than continue.
The log rotation system needs to be updated to support what you're trying to do here. We really just need to reopen the file without attempting to rename it.

Generated at Thu Feb 08 03:25:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.