[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 SERVER-504
http://github.com/mongodb/mongo/commit/566603ad8b9f77e62676fdf72c0164453bea39b3

Generated at Thu Feb 08 02:54:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.