[SERVER-504] acquirePathLock should truncate the lock file Created: 22/Dec/09 Updated: 26/Sep/17 Resolved: 22/Dec/09 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.3.0 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Stephen Haynes | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
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". |
| Comments |
| Comment by auto [ 23/Dec/09 ] |
|
Author: {'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: truncate lock file |