Bug 238060 - GNUCash importer creates invalid price entries
Summary: GNUCash importer creates invalid price entries
Status: RESOLVED WAITINGFORINFO
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-18 18:06 UTC by Susannah Burrows
Modified: 2011-10-15 14:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Susannah Burrows 2010-05-18 18:06:37 UTC
Application: kmymoney (3.97.2)
KDE Platform Version: 4.4.2 (KDE 4.4.2)
Qt Version: 4.6.2
Operating System: Linux 2.6.32-22-generic i686
Distribution: Ubuntu 10.04 LTS

-- Information about the crash:
Updating the price for one stock is successful.

Updating for all stocks always results in a crash.  I have tried to do this in two ways: (1) in the "Investments" screen, right-click on an account and select "Update Stock and Currency Prices..."; (2) in the "Tools" menu, select "Update Stock and Currency Prices...".

Either way, KMyMoney crashes every time.

The crash can be reproduced every time.

 -- Backtrace:
Application: KMyMoney (kmymoney), signal: Aborted
[KCrash Handler]
#6  0x00110422 in __kernel_vsyscall ()
#7  0x05b0e651 in raise () from /lib/tls/i686/cmov/libc.so.6
#8  0x05b11a82 in abort () from /lib/tls/i686/cmov/libc.so.6
#9  0x00b9052f in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#10 0x00b8e465 in ?? () from /usr/lib/libstdc++.so.6
#11 0x00b8e4a2 in std::terminate() () from /usr/lib/libstdc++.so.6
#12 0x00b8e55b in __cxa_rethrow () from /usr/lib/libstdc++.so.6
#13 0x032bd75a in QMetaObject::activate (sender=0xa300dd0, m=0x4f4fd58, local_signal_index=1, argv=0xbfef6f88) at kernel/qobject.cpp:3303
#14 0x04620bd9 in QAction::triggered (this=0xa300dd0, _t1=false) at .moc/release-shared/moc_qaction.cpp:263
#15 0x04622dcc in QAction::activate (this=0xa300dd0, event=QAction::Trigger) at kernel/qaction.cpp:1255
#16 0x04ac660c in QMenuPrivate::activateCausedStack (this=0xa458b10, causedStack=..., action=0xa300dd0, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:1011
#17 0x04accabb in QMenuPrivate::activateAction (this=0xa458b10, action=0xa300dd0, action_e=QAction::Trigger, self=<value optimized out>) at widgets/qmenu.cpp:1103
#18 0x04acdac7 in QMenu::mouseReleaseEvent (this=0xa458af0, e=0xbfef7820) at widgets/qmenu.cpp:2312
#19 0x00931f65 in KMenu::mouseReleaseEvent (this=0xa458af0, e=0xbfef7820) at ../../kdeui/widgets/kmenu.cpp:471
#20 0x046857f8 in QWidget::event (this=0xa458af0, event=0xbfef7820) at kernel/qwidget.cpp:7998
#21 0x04acf0cc in QMenu::event (this=0xa458af0, e=0xbfef7820) at widgets/qmenu.cpp:2414
#22 0x046274dc in QApplicationPrivate::notify_helper (this=0xa1a0508, receiver=0xa458af0, e=0xbfef7820) at kernel/qapplication.cpp:4300
#23 0x0462e9f7 in QApplication::notify (this=0xa1a0488, receiver=0xa458af0, e=0xbfef7820) at kernel/qapplication.cpp:3865
#24 0x0083bf2a in KApplication::notify (this=0xa1a0488, receiver=0xa458af0, event=0xbfef7820) at ../../kdeui/kernel/kapplication.cpp:302
#25 0x032a9a3b in QCoreApplication::notifyInternal (this=0xa1a0488, receiver=0xa458af0, event=0xbfef7820) at kernel/qcoreapplication.cpp:704
#26 0x0462d952 in QCoreApplication::sendEvent (receiver=0xa458af0, event=0xbfef7820, alienWidget=0x0, nativeWidget=0xa458af0, buttonDown=0x4f6b058, lastMouseReceiver=..., spontaneous=true)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#27 QApplicationPrivate::sendMouseEvent (receiver=0xa458af0, event=0xbfef7820, alienWidget=0x0, nativeWidget=0xa458af0, buttonDown=0x4f6b058, lastMouseReceiver=..., spontaneous=true)
    at kernel/qapplication.cpp:2965
#28 0x046b95cf in QETWidget::translateMouseEvent (this=0xa458af0, event=0xbfef7d3c) at kernel/qapplication_x11.cpp:4302
#29 0x046b8511 in QApplication::x11ProcessEvent (this=0xa1a0488, event=0xbfef7d3c) at kernel/qapplication_x11.cpp:3379
#30 0x046e760a in x11EventSourceDispatch (s=0xa1a3740, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#31 0x016c15e5 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#32 0x016c52d8 in ?? () from /lib/libglib-2.0.so.0
#33 0x016c54b8 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#34 0x032d55d5 in QEventDispatcherGlib::processEvents (this=0xa186198, flags=...) at kernel/qeventdispatcher_glib.cpp:412
#35 0x046e7135 in QGuiEventDispatcherGlib::processEvents (this=0xa186198, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#36 0x032a8059 in QEventLoop::processEvents (this=0xbfef8030, flags=) at kernel/qeventloop.cpp:149
#37 0x032a84aa in QEventLoop::exec (this=0xbfef8030, flags=...) at kernel/qeventloop.cpp:201
#38 0x04ac9dde in QMenu::exec (this=0xa458af0, p=..., action=0x0) at widgets/qmenu.cpp:2063
#39 0x08094a95 in _start ()

Possible duplicates by query: bug 237780, bug 237667, bug 236910, bug 236118, bug 235929.

Reported using DrKonqi
Comment 1 Alvaro Soliverez 2010-05-18 18:54:04 UTC
Can you try to update each stock individually, to verify if there is a particular one causing the problem?

Also, saving your file as anonymous file and attaching it to the bug might help us pinpoint the problem.
I use the Update all feature regularly and it works fine here, so it might be a particular source on one of your stocks.
Comment 2 Susannah Burrows 2010-05-18 19:37:22 UTC
Thanks for the quick reply!  I have updated each stock individually many times with no problems.

Could you explain to me how I can save my file as an "anonymous" file?
Comment 3 Susannah Burrows 2010-05-18 20:01:33 UTC
I think I've just discovered what is triggering the bug: the stock prices were in USD, but the base currency was EUR.  After changing the base currency to USD (matching the currency of all stock prices), saving the file, and restarting KMyMoney, I am no longer able to reproduce the bug.  When I switch back to using EUR as the base currency, the buggy behavior reappears.

This is good news for me, since it gives me a workaround.  However, I think it is still a bug that could affect users with multiple currencies, especially if they have investments in multiple currencies, in which case it is probably not possible to avoid the bug.
Comment 4 Alvaro Soliverez 2010-05-18 20:07:58 UTC
Weird. I do have stocks in multiple currencies.

To save as anonymous file, go to Save As.. and select anon.xml in the format.
Comment 5 Thomas Baumgart 2010-05-19 21:48:10 UTC
The problem's source seems to be in the area of the GnuCash importer. Details will follow.
Comment 6 Thomas Baumgart 2010-05-20 10:48:28 UTC
Yep, it really looks the GnuCash importer caused this trouble. Here's what I see in the anon file provided by Susannah who also confirms the import from GNC:

  <PRICEPAIR from="E000019" to="USD">
   <PRICE price="143600/10000" source="Imported Transaction" date="2007-11-28"/>
   :
   :
  </PRICEPAIR>

where E000019 links to the symbol MYL. In addition I see

  <PRICEPAIR from="USD" to="MYL">
   <PRICE price="359/25" source="Imported History" date="2007-11-28"/>
  </PRICEPAIR>

which is the same price on the same date but in a complete wrong format.

The file contained this scenario a second time, this time even weirder:

  <PRICEPAIR from="E000003" to="USD">
   <PRICE price="756200/10000" source="Imported Transaction" date="2005-10-31"/>
   :
   <PRICE price="540100000/10000000" source="Imported History" date="2007-05-15"/>
   <PRICE price="542800/10000" source="Imported Transaction" date="2007-05-16"/>
   <PRICE price="538670000/10000000" source="Imported History" date="2007-05-22">
   :
  </PRICEPAIR>

where E000003 links to the symbol AMGN. In addition I see

  <PRICEPAIR from="USD" to="AMGN">
   <PRICE price="58643/3183140" source="Imported History" date="2007-05-16"/>
  </PRICEPAIR>

though the price differs this time but the date is the same. The fun stuff is, that this is based on the second imported transaction and I don't see something like that generated for the first imported transaction referencing that security.

So I would suggest to take a look at the part that causes price entries based on transactions. I might be wrong though.
Comment 7 Thomas Baumgart 2010-05-27 08:53:39 UTC
We followed up on this off b.k.o and indeed, removing those weird entries solved the problem.

We now need to investigate why this happened in the first place to avoid it in the future.

Susannah still has the original Gnumeric data file where she imported from, so if someone knowledgeable about the GncImport needs information about that file, please contact her.
Comment 8 Tony B 2010-05-27 13:22:09 UTC
I'll look into the code, but as far as I can recall, GNC uses the same numerator/denominator strings as KMM, so I don't think the importer messes with them, just copies them. We don't have a detailed spec of the GNC file format, so it's possible that it interprets them incorrectly with regard to the currencies/investments involved. I'm pretty sure I never tested it against a file with multiple investment currencies, so I'm not too surprised there are problems.

(But I'm a little mystified as to how funny historical prices could cause a crash.)
Comment 9 Thomas Baumgart 2010-06-01 10:22:11 UTC
Rescheduled severity and adjusted title to reflect the problem.
Comment 10 Thomas Baumgart 2011-09-28 18:59:45 UTC
Any news on this? Otherwise, I'll close it.