<p>I have a question about locking. This doesn't have to be only about record locking, but anyway.</p>

<p>Let's say I'm writing a web accessible CMS. I am struggling with some ideas.</p>

<p>I could, on the moment when a user opens an article for editing, flag the article as being 'in use'. so far so good.</p>

<p>but when do I remove the flag? when the user saves the article? but what if the user doesn't feel like typing anymore and decides to close his browser and go to bed?</p>

<p>a time-out mechanism comes to mind, but how long does it take to write an article? 10 minutes too short, 30 minutes too long..</p>

<p>Maybe I am over-complicating this. I'd like to hear your thoughts on this subject.</p>

My vote is for
optimistic locking
wherever possible.
In one place, where I have implemented actual locks, I had an admin page to remove locks. There was also a service running on the server to unlock any locks which did not have a corresponding active session..