-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
When acquiring the lock in the acquirePathLock function the lock file should be truncated (O_TRUNC).
Without truncation a restart after an unclean shutdown (i.e. power failure or kill -9) could end up with unwanted characters in the lock file. For example if the previous pid was 12345 the contents of the file before the crash will be "12345\n". When mongod is restarted with new pid 987 the contents of the file will now be "987\n5\n".