[GNC] Unexpected behaviour of locking mechanis

Adrien Monteleone adrien.monteleone at lusfiber.net
Sat Apr 20 11:08:02 EDT 2019


I figured the lock was in the db, but wasn’t certain.

I just tested with my current data file:

Clean exit via GnuCash > Quit GnuCash
Copy & Rename file to `test-1234.gnucash`
Re-open GnuCash
File > Open > `test-1234.gnucash`

The file opened fine, save none of the open tabs from when I exited were re-opened. (doesn’t bother me any, and might even be intended behavior, but it confirms what mc found in that respect)

However, being on a Mac as you know I can't test double-clicking the renamed file to open it, if that is what mc is doing. Not sure if that is where the problem lies or if it was an un-clean shutdown after saving that other file as surmised.

Regards,
Adrien

> On Apr 20, 2019, at 9:53 AM, John Ralls <jralls at ceridwen.us> wrote:
> 
> 
> 
>> On Apr 20, 2019, at 5:58 AM, mc <mc8 at privmgt.com> wrote:
>> 
>> Config:
>> gnucash 3.5 clean install.
>> (X)ubuntu Linux 18.04
>> gnucash files saved as sqlite.
>> 
>> Am new to gnucash and testing it.
>> 
>> I keep several versions of a gnucash file,
>> saved with names like <file>-<date>-<id>.gnucash
>> 
>> After cleanly exiting gnucash by a normal Quit,,
>> I may try to open an earlier saved version.
>> I frequently get the message:
>> 
>> GnuCash could not obtain a lock for .../<filename>.gnucash
>> the database may be in use by another user, in which case you should not open the database.
>> What would you like to do?
>> open read only / create new file / open anyway / quit
>> 
>> I have checked that gnucash is not running,
>> and there is no lock file to be found.
>> I open it anyway, and it is without problems,
>> other than my tabs have disappeared and there is only the default "Accounts" tab.
>> 
>> In fact there is no .LCK file even when gnucash has a file opened.
>> 
>> So:
>> a.  has gnucash changed the locking mechanism in v3
>> or do sqlite files not use a locking mechanism?
>> 
>> b.  is there a possible issue with this locking mechanism?
> 
> The SQL locks are in a table inside the database, not in a separate file. The file will be locked if you didn't properly quit GnuCash the last time you had *that file* open.
> 
> The locking mechanism itself hasn't changed, but the SQL/DBI backend got a complete rewrite into C++ for GnuCash 3.x.
> 
> It's a computer program. Of course it's possible that there's a problem, and since you're doing something a bit different from what everyone else does you might be the first to have found it. How are you creating these "earlier saved versions"?
> 
> Regards,
> John Ralls



More information about the gnucash-user mailing list