GNOME Bugzilla – Bug 101705
Crash following OFX import
Last modified: 2018-06-29 20:23:26 UTC
Package: GnuCash Severity: normal Version: 1.7.5 Synopsis: Crash following OFX import Bugzilla-Product: GnuCash Bugzilla-Component: Import Description: Imported a month's worth of bank statement, worked through the import transaction matcher, clicked on OK. Gnucash crashed. Debugging Information: (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...(no debugging symbols found)... (no debugging symbols found)...[New Thread 1024 (LWP 1982)] 0x420b48b9 in wait4 () from /lib/i686/libc.so.6
+ Trace 31927
------- Bug moved to this database by unknown@bugzilla.gnome.org 2002-12-20 18:50 ------- Reassigning to the default owner of the component, chris@wilddev.net.
First: there have been major changes in the import matcher code between 1.7.5 and 1.7.6. Can you please try again with 1.7.6 and tell us whether this bug still occurs? Also, somehow this is multi-currency related. What is your "account default currency" setting in the general preferences? What are the currencies in the imported OFX file? Did you create any new accounts during your import, and if so, with which currencies?
I'm just downloading a new CVS, I'll see if the bug still exists in the new one. This is of course if I can manage to do an OFX import at all, given my problems with OFX import hangs (bug id 101738). With regard to your other questions, my default currency is GBP, I wasn't creating any new accounts, and the import file contained the details from one account, in GBP.
Yes, bug is still there as at 28th December.
You may wish to check Josh's comments on bug 101650. It may be related to this one. I'll try running without LANG=en_GB set and see if the crash doesn't happen.
No, wasn't that. Bother.
*** Bug 102105 has been marked as a duplicate of this bug. ***
Imported entire file without manual intervention, no problem. Moved first red item (third transaction) to manual reconcile and got crash. Debug output as follows: Debug: clist_select_row_cb: row_number: 2, column: 5 Debug: refresh_clist_row: Begin Debug: clist_select_row_cb: row_number: 2, column: 8 Debug: gnc_import_select_account: Default commodity received: British Pound Debug: gnc_import_select_account: Default account type received: Debug: gnc_import_select_account: Looking for account with online_id: (null) WRITEME: gnc_import_select_account() Here we should check if account type is compatible, currency matches, etc. Debug: gnc_import_select_account: Return value: 0x822ce30, account name:Miscellaneous Debug: refresh_clist_row: Begin <CRASH at this point>
More details. This bug occurs when two ofx imports overlap. Somehow, this results in gnc_import_set_trans_online_id attempting to free space that either didn't come from malloc, or has already been freed. I have been unable to find where the mis-alloc takes place, but a proposed patch is attached which fixes the problem. I've tested this patch reasonably rigorously with several ofx files from my bank which previously caused crashes. It seems solid. However, you will probably want to re-assign this back to Christian as it is his code that I have patched.
Created attachment 13547 [details] [review] Patch for bad free() in gnc_import_set_trans_online_id
This patch certainly looks safe to me. I'll commit it to CVS.
Still no crashes, despite numerous imports, including overlaps. I'm not sure what to do about this bug. The patch fixes the symptoms, and is safe, and has been merged into the CVS. However, I have a strong nagging feeling that the original malloc() - free() - use is still there, just not causing any problems at the moment. I believe it to be in the generic importer, but heaven knows where, and I believe it will re-surface at some point in the future, once use of the OFX import mechanism is more extensive.
I've applied Nigel's solution in the other instance I found. Hopefully this bug is permanently closed.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=101705. Please update any external references or bookmarks.