Database locked after crash - python bindings

Mike Evans mikee at saxicola.idps.co.uk
Sat Nov 6 06:05:04 EDT 2010


On Friday November 5 2010 21:58:57 John Ralls wrote:
> On Nov 5, 2010, at 2:09 PM, Christoph Holtermann wrote:
> > Hello !
> > 
> > Am 05.11.2010 21:46, schrieb John Ralls:
> >> On Nov 5, 2010, at 12:58 PM, Christoph Holtermann wrote:
> >>> Hello !
> >>> 
> >>> In addition to the previous :
> >>> 
> >>> I just tried to find out what actually crashes the reports. I put it to
> >>> some instability in my system. Crash means Segmentation fault.
> >>> 
> >>> Access to database is also not possible with python anymore. Is there a
> >>> possibility from there or anywhere to reset the database lock or by
> >>> hand in Mysql (which I use, I forgot to tell) ?
> >> 
> >> Yes, open the database with mysql and either drop the GNCLOCK table or
> >> delete the row (there should be only one) with DELETE * FROM GNCLOCK.
> >> 
> >> I just tested again with mysql on Debian, and it worked fine. (start
> >> gnucash, connect to mysql db, kill gnucash from the command line,
> >> restart gnucash. It prompts to break the lock, then opens the database,
> >> and checking the GNCLOCK table shows the new pid.)
> >> 
> >> What happens when you try to connect?
> >> 
> >> Regards,
> >> John Ralls
> > 
> > My Python skripts leads to following output :
> > 
> > * 22:06:24  WARN <gnc.backend.dbi> [gnc_dbi_unlock()] There was no lock
> > entry in the Lock table
> > ------------------------------------------------------------------------
> > --- GnuCashBackendException                   Traceback (most recent call
> > last)
> > 
> > /home/christoph/Computer/Programmieren/Python/gnucash/IGnc.py in
> > <module>()
> > 
> >    104
> >    105 ipshell= IPShellEmbed()
> > 

SNIP
> > 
> > --> 107                 errors )
> > 
> >    108
> > 
> >    109     def generate_errors(self):
> > GnuCashBackendException: call to begin resulted in the following errors,
> > (7,)
> > 
> > gnucash starts, I get that "force open" window. When I say yes it gets
> > stuck somewhere.
> > 
> > bye and thanks for your assistance,
> 
> By "gets stuck somewhere" I trust that you mean that it hangs rather than
> segfaulting. Without a stack trace at least showing where it's hanging I
> don't think that there's much we can do to help.
> 
> Commenting on your python trace, it's a bit odd, because the warning about
> not finding a lock entry is issued when the database is closed, not when
> it's opened. (It doesn't expect to find a lock entry on open. The db isn't
> supposed to be locked.)
> 
> Note that the python bindings are contributed code, so at this point I
> think it's up to the guys who contributed to take over.
> 
> Regards,
> John Ralls
> 
With regard to Python bindings: The error (7,) is the same if you try to open 
a locked xml file.  I'd think the python script would need to be amended to 
trap the error and ask the user whether to continue or not.  There'd then need 
to be some SQL to remove the lock.  It would seem to be correct behaviour to 
stop on encountering a locked database.
Mike E


-- 
GPG Key: 1024D/050895C2
Keyserver: http://pgp.mit.edu/          
Search String: 0x050895C2


More information about the gnucash-devel mailing list