Error message" . . . could not obtain the lock for c:\ . . . . . ."

Mike or Penny Novack stepbystepfarm at mtdata.com
Sun Mar 9 09:27:23 EDT 2008


>It means that gnucash didn't exit normally the last time you used that  
>data file. When gnucash opens a data file, it sets a lock to prevent  
>any other person/process from modifying the file while the file is  
>open for editing. When you close the file or quit gnucash, the lock is  
>released. If something goes wrong during file closing, the lock (a  
>separate file) still exists. Gnucash detects the lock when you try to  
>open the file again and displays the dialog you are seeing.
>  
>
Because this comes up with regard to other multi-platform open source 
applications I will try to explain.

People who have only ever used Windows and apps designed just for 
Windows aren't used to having to deal with data locks. The reason is 
that while versions of Windows support multiple SEQUENTIAL users doesn't 
support multiple SIMULTANEOUS users. True, very few personal use 
computer systems are set up to allow multiple users, but operating 
systems such as Linux, BSD, etc. would support multiple simultaneous 
users sharing data. Now that's safe enough for "read only" data but it 
isn't safe for "write" access, hence data locks provided to prevent two 
users who are logged in at the same accessing the same non-sharable 
resource. In other words, GnuCash does data locking because as a 
multiple platform application, it has to be able to also work correctly 
when running in environments that allow multiple simultaneous users. It 
can't assume that there is only one user at a time.

That's why it is safe to override the warning. You know whether on YOUR 
system there is or isn't another instance of GnuCash running that is 
accessing the same resource (in this case, a set of books). Hey, look on 
the bright side. GnuCash is allowing you to simply override the lock. 
With some applications you have to manually clear (delete) the data lock.

Michael

PS -- the alternative to simple data locks is a full blown DBM (database 
manager) and those are a major undertaking and in most cases would still 
require an administrative "reset" following a crash. Most systems that 
have multiple simultaneous users would be in "shops" that had a tech 
support person on hand to take care of things like this and most such 
systems are also much more robust than home systems (a crash would be a 
rare event).


More information about the gnucash-user mailing list