After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764871 - Crash starting gnu cash
Crash starting gnu cash
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: General
2.6.12
Other Linux
: Normal major
: ---
Assigned To: gnucash-general-maint
gnucash-general-maint
: 769571 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-04-11 00:57 UTC by jch
Modified: 2018-06-29 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnucash.trace (229 bytes, text/plain)
2016-04-11 01:16 UTC, jch
Details
gnucash.trace with --debug and --extra (2.76 MB, text/plain)
2016-04-11 01:20 UTC, jch
Details
Screen shot (113.59 KB, image/png)
2016-05-03 23:27 UTC, jch
Details
Template 1 of 3 (64.30 KB, image/png)
2016-05-14 00:56 UTC, jch
Details
Template 2 of 3 (60.66 KB, image/png)
2016-05-14 00:57 UTC, jch
Details
Template 3 of 3 (58.82 KB, image/png)
2016-05-14 00:57 UTC, jch
Details
formulas (3.63 KB, text/plain)
2016-05-22 12:55 UTC, jch
Details
%numeric (3.00 KB, text/plain)
2016-05-23 12:38 UTC, jch
Details

Description jch 2016-04-11 00:57:34 UTC
OS: Ubuntu 14.04 64-bit
MySQL database on another machine

The crash does not occur if there is the lock present from a previous crash and I tell it to open the database read-only.

Running under gdb, I get the UI pane about adding transations.  Sometimes I get a pop-up that says "Invalid Transaction" and some unprintable characters.
Comment 1 jch 2016-04-11 00:57:45 UTC
jch@kismet[521]:~$ gdb gnucash
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gnucash...(no debugging symbols found)...done.
(gdb) c
The program is not being run.
(gdb) r
Starting program: /usr/bin/gnucash 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdba31700 (LWP 2987)]
[New Thread 0x7fffdb230700 (LWP 2988)]
[New Thread 0x7fffd9a2b700 (LWP 2991)]
Found Finance::Quote version 1.18
[New Thread 0x7fffb2094700 (LWP 3021)]
[Thread 0x7fffb2094700 (LWP 3021) exited]
*** Error in `/usr/bin/gnucash': double free or corruption (out): 0x0000000002e87260 ***

Program received signal SIGABRT, Aborted.
0x00007ffff5a31cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
  • #0 __GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 56
  • #1 __GI_abort
    at abort.c line 89
  • #2 __libc_message
    at ../sysdeps/posix/libc_fatal.c line 175
  • #3 malloc_printerr
  • #4 _int_free
    at malloc.c line 3840
  • #5 ??
    from /usr/lib/x86_64-linux-gnu/gnucash/libgnc-gnome.so.0
  • #6 gnc_sx_sxsincelast_book_opened
    from /usr/lib/x86_64-linux-gnu/gnucash/libgnc-gnome.so.0
  • #7 ??
    from /usr/lib/x86_64-linux-gnu/gnucash/gnucash/libgncmod-engine.so
  • #8 g_hook_list_marshal
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #9 gnc_hook_run
    from /usr/lib/x86_64-linux-gnu/gnucash/gnucash/libgncmod-engine.so
  • #10 ??
    from /usr/lib/x86_64-linux-gnu/gnucash/gnucash/libgncmod-gnome-utils.so
  • #11 _start

Comment 2 jch 2016-04-11 01:06:32 UTC
This time with symbols:

jch@kismet[524]:~$ gdb gnucash
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gnucash...Reading symbols from /usr/lib/debug/.build-id/cf/b382061b2f465013eeb6f5974e2540f07e6e2c.debug...done.
done.
(gdb) run
Starting program: /usr/bin/gnucash 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdba31700 (LWP 7262)]
[New Thread 0x7fffdb230700 (LWP 7263)]
[New Thread 0x7fffd9a2b700 (LWP 7266)]
Found Finance::Quote version 1.18
[New Thread 0x7fffb2094700 (LWP 7290)]
[Thread 0x7fffb2094700 (LWP 7290) exited]
*** Error in `/usr/bin/gnucash': double free or corruption (out): 0x0000000002e8f2c0 ***

Program received signal SIGABRT, Aborted.
0x00007ffff5a31cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
  • #0 __GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 56
  • #1 __GI_abort
    at abort.c line 89
  • #2 __libc_message
    at ../sysdeps/posix/libc_fatal.c line 175
  • #3 malloc_printerr
  • #4 _int_free
    at malloc.c line 3840
  • #5 creation_error_dialog
    at dialog-sx-since-last-run.c line 810
  • #6 gnc_sx_sxsincelast_book_opened
    at dialog-sx-since-last-run.c line 874
  • #7 call_c_hook
    at gnc-hooks.c line 217
  • #8 g_hook_list_marshal
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #9 gnc_hook_run
    at gnc-hooks.c line 233
  • #10 gnc_book_opened
    at gnc-file.c line 509
  • #11 gnc_post_file_open
    at gnc-file.c line 990
  • #12 gnc_file_open_file
    at gnc-file.c line 1057
  • #13 inner_main
    at gnucash-bin.c line 608
  • #14 ??
    from /usr/lib/libguile-2.0.so.22
  • #15 ??
    from /usr/lib/libguile-2.0.so.22
  • #16 ??
    from /usr/lib/libguile-2.0.so.22
  • #17 scm_call_4
    from /usr/lib/libguile-2.0.so.22
  • #18 ??
    from /usr/lib/libguile-2.0.so.22
  • #19 scm_c_with_continuation_barrier
    from /usr/lib/libguile-2.0.so.22
  • #20 ??
    from /usr/lib/libguile-2.0.so.22
  • #21 GC_call_with_stack_base
    from /usr/lib/x86_64-linux-gnu/libgc.so.1
  • #22 scm_with_guile
    from /usr/lib/libguile-2.0.so.22
  • #23 scm_boot_guile
    from /usr/lib/libguile-2.0.so.22
  • #24 main
    at gnucash-bin.c line 778

Comment 3 jch 2016-04-11 01:16:31 UTC
Created attachment 325693 [details]
gnucash.trace
Comment 4 jch 2016-04-11 01:20:05 UTC
Created attachment 325694 [details]
gnucash.trace with --debug and --extra
Comment 5 John Ralls 2016-04-13 03:26:13 UTC
I think I've found the error. Can you show a sanitized version of the defective SX so that I can try to reproduce the crash and see if I have fixed it?
Comment 6 jch 2016-05-03 23:27:29 UTC
Created attachment 327256 [details]
Screen shot

John,

Here is a screenshot of the scheduled transactions page.  Let me know if you want more detail on any of them.

Is there a better way than a screen shot?

Thanks.

Jeff

P.S. Sorry for the delay, FIRST Robotics Champs got in the way.
Comment 7 John Ralls 2016-05-10 21:14:25 UTC
Sorry for my delay, I was away last week.

I need the Template Transaction for the problem transaction. You can either make a screenshot or just describe it. If you can't figure out which of the three SXes is causing the problem describe or make screenshots of all three.
Comment 8 jch 2016-05-14 00:56:41 UTC
Created attachment 327839 [details]
Template 1 of 3
Comment 9 jch 2016-05-14 00:57:03 UTC
Created attachment 327840 [details]
Template 2 of 3
Comment 10 jch 2016-05-14 00:57:25 UTC
Created attachment 327842 [details]
Template 3 of 3
Comment 11 jch 2016-05-14 00:57:46 UTC
Screenshots of the templates for all three schedule transactions I have are attached.
Comment 12 John Ralls 2016-05-14 02:42:35 UTC
No. 2 seems in the screenshots to have blank debit/credit entries, is that real?
BTW, it looks like #1 is moving money from Assets:HSA to Income:Employer Contribution. That seems backwards.
Comment 13 jch 2016-05-14 11:28:49 UTC
Yes, #2 just creates the entry for interest, I fill in the amounts when I look them up. I've been using this one for years.

#1 could be backward, it also might be the one causing the crash as it only runs quarterly.  I created it earlier this year.
Comment 14 John Ralls 2016-05-17 22:28:10 UTC
We finally have a Windows nightly build to test on:
http://code.gnucash.org/builds/win32/maint/gnucash-2.6.12-2016-05-17-git-c1ad615+-setup.exe
Comment 15 jch 2016-05-18 01:28:23 UTC
(In reply to John Ralls from comment #14)
> We finally have a Windows nightly build to test on:
> http://code.gnucash.org/builds/win32/maint/gnucash-2.6.12-2016-05-17-git-
> c1ad615+-setup.exe

My sympathies.

Anything for Linux?
Comment 16 John Ralls 2016-05-18 02:41:05 UTC
Sigh. Sorry, I put that on the wrong bug.

Are you able to build? I can give you a patch to try.
Comment 17 John Ralls 2016-05-19 18:11:44 UTC
I can't create an SX that will raise the error; I suspect that you have a malformed SX saved with a version of GnuCash from before the fixes to the SX edit code that protect against creating such bad SXes. I've fixed the mistake pointed to by the stack trace and pushed it.

If you can use Fedora 21, 22, or 23 RPMs, nightly builds for each should show up around 05:05Z tomorrow at https://copr-be.cloud.fedoraproject.org/results/gjanssens/gnucash-maint/. You'll need to go to the appropriate version directory and find the right nightly build.
Comment 18 jch 2016-05-21 02:04:56 UTC
I use Ubuntu 14.04 at the moment.  So I'll either need to spin up a Docker container or build for 14.04.  My database is in SQL, would the results of some queries help you recreate?
Comment 19 John Ralls 2016-05-21 04:09:05 UTC
Well, the results of 
SELECT * FROM slots WHERE name LIKE "%formula";
would tell me which one's wrong and why. I could try hand-editing a test file to inject a similar error.
Comment 20 jch 2016-05-22 12:55:08 UTC
Created attachment 328341 [details]
formulas
Comment 21 John Ralls 2016-05-22 13:55:03 UTC
Thanks. You've got a single-split SX in there, that's likely the real problem. 

DELETE FROM slots WHERE obj_guid = "bd7a3076fe8c4bdb8c759eeb490124a8" OR guid_val = "bd7a3076fe8c4bdb8c759eeb490124a8";

will remove it and will probably let you start GnuCash 2.6.12. For absolute safety first do that query with SELECT * instead of DELETE and check the results.
Comment 22 jch 2016-05-22 23:59:13 UTC
John,

I did that and still got the crash.  I then deleted all the scheduled entries (DELETE FROM slots WHERE name LIKE "%forumula";) and *still* get a crash.  See the trace here:



jch@kismet[509]:~$ gdb gnucash
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gnucash...Reading symbols from /usr/lib/debug/.build-id/cf/b382061b2f465013eeb6f5974e2540f07e6e2c.debug...done.
done.
(gdb) run
Starting program: /usr/bin/gnucash 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdb825700 (LWP 24240)]
[New Thread 0x7fffdacda700 (LWP 24244)]
[New Thread 0x7fffda4d9700 (LWP 24245)]
Found Finance::Quote version 1.18
[New Thread 0x7fffbf6b6700 (LWP 24308)]
[Thread 0x7fffbf6b6700 (LWP 24308) exited]
*** Error in `/usr/bin/gnucash': free(): invalid pointer: 0x0000000002f29420 ***

Program received signal SIGABRT, Aborted.
0x00007ffff5a31cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
  • #0 __GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 56
  • #1 __GI_abort
    at abort.c line 89
  • #2 __libc_message
    at ../sysdeps/posix/libc_fatal.c line 175
  • #3 malloc_printerr
  • #4 _int_free
    at malloc.c line 3840
  • #5 creation_error_dialog
    at dialog-sx-since-last-run.c line 810
  • #6 gnc_sx_sxsincelast_book_opened
    at dialog-sx-since-last-run.c line 874
  • #7 call_c_hook
    at gnc-hooks.c line 217
  • #8 g_hook_list_marshal
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #9 gnc_hook_run
    at gnc-hooks.c line 233
  • #10 gnc_book_opened
    at gnc-file.c line 509
  • #11 gnc_post_file_open
    at gnc-file.c line 990
  • #12 gnc_file_open_file
    at gnc-file.c line 1057
  • #13 inner_main
    at gnucash-bin.c line 608
  • #14 ??
    from /usr/lib/libguile-2.0.so.22
  • #15 ??
    from /usr/lib/libguile-2.0.so.22
  • #16 ??
    from /usr/lib/libguile-2.0.so.22
  • #17 scm_call_4
    from /usr/lib/libguile-2.0.so.22
  • #18 ??
    from /usr/lib/libguile-2.0.so.22
  • #19 scm_c_with_continuation_barrier
    from /usr/lib/libguile-2.0.so.22
  • #20 ??
    from /usr/lib/libguile-2.0.so.22
  • #21 GC_call_with_stack_base
    from /usr/lib/x86_64-linux-gnu/libgc.so.1
  • #22 scm_with_guile
    from /usr/lib/libguile-2.0.so.22
  • #23 scm_boot_guile
    from /usr/lib/libguile-2.0.so.22
  • #24 main
    at gnucash-bin.c line 778

Comment 23 jch 2016-05-23 00:00:35 UTC
Is it still worth trying a nightly build on Fedora?  I tried building the sources on 14.04, but I have too many version conflicts with required packages.
Comment 24 John Ralls 2016-05-23 00:27:34 UTC
I've successfully recreated your crash and confirmed that my fix prevents it, so there's no real need for you to set up a Fedora VM or build yourself.

DELETE FROM slots WHERE name LIKE "%formula"; doesn't delete anything that would raise the error. It turns out I was mistaken about a single-legged SX, it happily creates an imbalance entry without complaint. If the DELETE query I gave you didn't work either then you don't have a bad account GUID either; that was my next guess and what I used to check that the crash is fixed.

If you crash it in the debugger again and then
  f 5
  p (GString*)(node->data)->str()
it should print out the actual error. With that I'll know what to delete to clean up the error. I hope you made a backup before running those delete queries.

BTW, while you don't need to build you shouldn't get version conflicts. Did you run
  sudo apt-get build-dep gnucash
like the FAQ says?
Comment 25 jch 2016-05-23 00:35:39 UTC
Here is the output you asked for:

810	dialog-sx-since-last-run.c: No such file or directory.
(gdb) p (GString*)(node->data)->str()
Attempt to dereference a generic pointer.

I have regular mysql backups.  I can also easily recreate those three scheduled transactions.  Are there more entries I can delete go tet 2.6.12 running again before your fix propagates?

Thanks.

Jeff
Comment 26 John Ralls 2016-05-23 00:56:49 UTC
Sorry, the second gdb command should be
  p ((GString*)(node->data))->str()

Here's one that should get you in so that you can edit the transactions:
UPDATE schedxactions SET enabled = '0';

That will turn them all off so the Since Last Run dialog won't do anything and there won't be any errors to free. Then you can delete them all in the UI and recreate the ones that you want, or try enabling them one at a time to find the bad one.
Comment 27 jch 2016-05-23 01:02:11 UTC
Hmm, I don't think this is what you expect:

810	dialog-sx-since-last-run.c: No such file or directory.
(gdb) p ((GString*)(node->data))->str()

Program received signal SIGSEGV, Segmentation fault.
0x00000000009deee0 in ?? ()
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(at 0x0x9deee0) will be abandoned.
When the function is done executing, GDB will silently stop.
Comment 28 jch 2016-05-23 01:05:04 UTC
This is what you were looking for:

(gdb) p *((GString*)(node->data))
$2 = {str = 0x363bf70 "error -3 in SX [HSA Wind Quarterly] final gnc_numeric value, using 0 instead", len = 76, allocated_len = 128}
Comment 29 John Ralls 2016-05-23 03:16:30 UTC
(In reply to jch from comment #28)
> This is what you were looking for:
> 
> (gdb) p *((GString*)(node->data))
> $2 = {str = 0x363bf70 "error -3 in SX [HSA Wind Quarterly] final gnc_numeric
> value, using 0 instead", len = 76, allocated_len = 128}

Yup, thanks for figuring out my mistake.

 Interesting, not at all the SX I suspected. 
Can you set a breakpoint:
  b gnc-sx-instance-model.c:1079
run it and do
  info locals

I think it's going to tell me that it's trying to calculate 37500/100 - 0/1 and barfing because 100 != 1. If I'm right then we need a special case in the round-fixed routine to not raise that error when one of the operands is 0/1.
Comment 30 jch 2016-05-23 03:45:13 UTC
Breakpoint 1, split_apply_formulas (creation_data=0x7fffffffe1d0, creation_data=0x7fffffffe1d0, split=<optimized out>) at gnc-sx-instance-model.c:1079
1079	gnc-sx-instance-model.c: No such file or directory.
(gdb) info locals
err = <optimized out>
credit_num = {num = 375, denom = 1}
debit_num = {num = 8014, denom = 25}
final = {num = -3, denom = 0}
gncn_error = -3
sx = 0x2ea9070
Comment 31 John Ralls 2016-05-23 04:08:36 UTC
8014/25 (320.56)? Where the heck did *that* come from?

Have you restored from backup or is this with all of the SX formulas deleted?
Does
  SELECT * FROM slots WHERE name LIKE "%numeric";
return anything?
Comment 32 jch 2016-05-23 12:38:15 UTC
No, I have not restored from backup, I'm not going to change anything until you have all the info.

That query returns the attached numeric.txt.  I suspect that is a former value for what is now 375.
Comment 33 jch 2016-05-23 12:38:37 UTC
Created attachment 328381 [details]
%numeric
Comment 34 John Ralls 2016-05-23 17:04:37 UTC
OK, that is indeed where the problem is. In order to avoid parsing issues with commas and dots depending on locale, beginning in 2.4.0 GC immediately stores a numeric when the formula has no variables. It appears that at some point you edited the the "HSA Wind Quarterly" SX and changed the amount and direction and somehow the numeric didn't get cleared on only one of the splits. I'll drag through the code and figure out why not.

I have the information I need from your data, so go ahead and restore from backup. The safest query to make your database load in 2.6.12 is the UPDATE one from comment 26. I suggest that once you're in you delete and recreate "HSA Wind Quarterly" so that it's clean with no hidden numeric values to cause trouble. You'll have to enable the other two from the Overview tab of the SX editor.
Comment 35 John Ralls 2016-08-08 15:29:31 UTC
*** Bug 769571 has been marked as a duplicate of this bug. ***
Comment 36 John Ralls 2018-06-29 23:48:27 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=764871. Please update any external references or bookmarks.