GNOME Bugzilla – Bug 674283
With mysql crash after deleting accounts included into a budget
Last modified: 2018-06-29 23:08:20 UTC
Create a bidget that includes all accounts Delete two accounts that are empty Close gnucash Open gnucash It says: GnuCash could not obtain the lock for mysql://gnucash:xxxxx@localhost/gnucash. That database may be in use by another user, in which case you should not open the database. What would you like to do? Try to select Open Anyway You get a Segmentation fault The tracefile says: WARN <gnc.backend.sql> [load_account_guid()] Account ref d9dfe368df7d7346aac10bf09023972f' not found The backtrace with debugging symbols is at http://pastebin.com/u17DeWym Comparing the mysqldump before and after the crash, I recovered my data adding back the two deleted accounts INSERT INTO `accounts` VALUES ('9c3390b42097dedb2331acbb304ce23e','Orfano-EUR','BANK','0b5cfa6f4257a5587f779ed74429427a',100,0,'0d3d4d3637a21abc16e19624ed3c9b0a','','',0,0); INSERT INTO `accounts` VALUES ('d9dfe368df7d7346aac10bf09023972f','Sbilancio-EUR','BANK','0b5cfa6f4257a5587f779ed74429427a',100,0,'0d3d4d3637a21abc16e19624ed3c9b0a','','',0,0);
For convenience and long-term record, here's the stack trace: Program received signal SIGSEGV, Segmentation fault. 0x00007ffff309a540 in g_type_check_instance_cast () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (gdb) bt
+ Trace 230078
That's a rather insidious crash. It appears that the account object being passed contains pointers either to freed memory or to memory outside of the process address space. That might be a result of the screwed up memory management in the engine, which will get fixed in due course (but not in 2.4.x). Can you crash it again in the debugger, switch to frame 1, p *account, and post the results? Did you delete the accounts using MySql or from inside Gnucash? Do I understand correctly that using MySql to reinsert the account records made the database loadable once more?
I'm not used to gdb, so If you can help me a little bit more, I'll try to get the backtrace the way you need. If you can, you can join me on #gnucash on IRC. Before the problem, I deleted the accounts from inside gnucash. Never acted directly on the database manually. After deleting these accounts, I normally closed gnucash, without errors. When I reopened it, I received the error. To fix things, i had to manually execute the two INSERT sql queries to readd the accounts. After this, gnucash was able to reopen the database without any clue. I have the pre and post crash mysqldumps of the databases If you need them.
Another note: I can reproduce the crash with the database dumps. I tried to export my data to xml, and made the same operations that lead me to the crash, but the crash didn't occur. So I think it's a problem totally related to sql stuffs ...
I can't IRC with you today, maybe tomorrow. The gdb commands are: f 1 to switch to frame 1 of the backtrace p *account to print the account structure However, I suspect that the problem is that deleting the account isn't marking the budget "dirty", so it isn't getting written out to the DB. I'll have a look at that on Thursday.
*** Bug 643363 has been marked as a duplicate of this bug. ***
Can you look in the after-deleting-the-account XML file (it might be gzipped unless you've told it not to in preferences) and paste the budget element here?
Never mind, I can replicate the crash now. As a work around, you can do a "file save all" to your database after deleting an account, which will save the budget in the correct state.
Fixed with r22154/22155.
Reassign version to 2.4.x so that individual 2.4 versions can be retired.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=674283. Please update any external references or bookmarks.