Results 1 to 5 of 5
Simple question. Had a friend who couldn't run Firefox on a college computer for a year, had a look into it and it was an unremoved lock file. How do ...
- 03-02-2011 #1Just Joined!
- Join Date
- Oct 2009
- Posts
- 59
How do lock files work on Linux?
Simple question. Had a friend who couldn't run Firefox on a college computer for a year, had a look into it and it was an unremoved lock file. How do these files work that such a problem can come up? Shouldn't they be somehow flagged and removed after a reboot or logoff or is there a similar mechanism that should prevent this?
- 03-03-2011 #2
They should be removed as soon as the app is closed, but sometimes stuff happens, and sometimes it doesn't happen. Once in awhile a lock file just doesn't get removed for some reason.
- 03-03-2011 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,954
On Linux/Unix systems, file locks are advisory only. An application that uses them often will have an override option to deal with such detritus left behind when the application/server/system crashed, though sometimes you have to manually remove them (the lock files).
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-04-2011 #4Just Joined!
- Join Date
- Oct 2009
- Posts
- 59
Was just wondering if there is some kind of flag that makes the file temporary and it will disappear whenever the system reboots. Or the app/system could use ram for lock files - when the system reboots the RAM gets wiped and all locked fill still there errors could be fixed.
- 03-04-2011 #5Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,954
That's up to the application. There are OS-level locks - in memory only, created with the flock() function - they go away when the system reboots or the application dies. There are file-level locks - a lock file is created - they stay around unless the creating application unlinks them. In theory, if these lock files were created in /tmp, then they should go away upon reboot; however, this is not necessarily the case. I see a lot of files in /tmp that stay around for some time, even between reboots.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote

