The locking within logRotate only covers the swap of file handles, but renaming an open log file while it is being written to by another thread is not safe. The locking needs to be modified so that no race conditions exist.
In addition, doing log rotation from a signal handler may be unsafe. It would be better to set a flag in the signal handler, and respond to it from a normal (non-signal) code path. For example, we could rotate the log next time something is logged.
Currently there is a deadlock if the current thread is in the middle of logging.
- is duplicated by
-
SERVER-7707 MongoDB 2.2.1/Linux, 32-bit crashing upon log rotation
- Closed
-
SERVER-3339 mongod process hangs after USR1 signal
- Closed
- is related to
-
SERVER-9578 mongos dies on SIGUSR1 instead of rotating logs
- Closed
- related to
-
SERVER-4905 logRotate should conform to standard log rotation mechanisms
- Closed