Bug 271914 - Crash in Reports - Investment
Summary: Crash in Reports - Investment
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-28 11:32 UTC by allan
Modified: 2011-05-06 21:09 UTC (History)
0 users

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 allan 2011-04-28 11:32:16 UTC
Application: kmymoney (4.5.90-svn1225922)
KDE Platform Version: 4.6.00 (4.6.0) "release 6" (Compiled from sources)
Qt Version: 4.7.1
Operating System: Linux 2.6.37.1-1.2-desktop x86_64
Distribution: "openSUSE 11.4 (x86_64)"

-- Information about the crash:
- What I was doing when the application crashed:

I had produced an investment performance report by account.  I started to change the dates, completed the start date - from 3 Mar 2010 to 1 Apr 2010, then was changing the end date from 27 Apr 2011 to 31 Mar 2011.  On clicking 'OK', KMM crashed.

It seems to happen every time.

-- Backtrace:
Application: KMyMoney (kmymoney), signal: Floating point exception
[KCrash Handler]
#6  0x00007f49fa4c417b in raise () from /lib64/libpthread.so.0
#7  0x00007f49f761351e in __gmp_invalid_operation () from /usr/lib64/libgmp.so.10
#8  0x00007f49f762f60f in __gmpq_set_d () from /usr/lib64/libgmp.so.10
#9  0x00007f49fab2f537 in operator= (this=0x7fff12fc45c0, dAmount=@0x7fff12fc4438, denom=10000) at /usr/include/gmpxx.h:1808
#10 AlkValue::AlkValue (this=0x7fff12fc45c0, dAmount=@0x7fff12fc4438, denom=10000) at /home/aga/libalkimia-4.3.0/alkvalue.cpp:117
#11 0x000000000057114f in MyMoneyMoney (this=0x1358130, account=..., result=...) at /home/aga/CSV/kmymoney/kmymoney/mymoney/mymoneymoney.h:266
#12 reports::QueryTable::constructPerformanceRow (this=0x1358130, account=..., result=...) at /home/aga/CSV/kmymoney/kmymoney/reports/querytable.cpp:1045
#13 0x000000000057eaeb in reports::QueryTable::constructAccountTable (this=0x1358130) at /home/aga/CSV/kmymoney/kmymoney/reports/querytable.cpp:1132
#14 0x000000000057f2a9 in reports::QueryTable::init (this=0x1358130) at /home/aga/CSV/kmymoney/kmymoney/reports/querytable.cpp:262
#15 0x000000000057fe1f in reports::QueryTable::QueryTable (this=0x1358130, _report=<value optimized out>) at /home/aga/CSV/kmymoney/kmymoney/reports/querytable.cpp:252
#16 0x00000000004db7d9 in KReportsView::KReportTab::updateReport (this=0x1e0bec0) at /home/aga/CSV/kmymoney/kmymoney/views/kreportsview.cpp:183
#17 0x00000000004e16de in KReportsView::loadView (this=0x13fc0b0) at /home/aga/CSV/kmymoney/kmymoney/views/kreportsview.cpp:549
#18 0x00000000004e1d6d in KReportsView::slotLoadView (this=0x13fc0b0) at /home/aga/CSV/kmymoney/kmymoney/views/kreportsview.cpp:365
#19 0x00000000004e1e61 in KReportsView::qt_metacall (this=0x13fc0b0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff12fc59b0) at /home/aga/CSV/kmymoney/build/kmymoney/views/kreportsview.moc:115
#20 0x00007f49f93f1def in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#21 0x00007f49fcc5fcf3 in MyMoneyFile::commitTransaction (this=0x7f49fcec0550) at /home/aga/CSV/kmymoney/kmymoney/mymoney/mymoneyfile.cpp:388
#22 0x00007f49fcc5fdc5 in MyMoneyFileTransaction::commit (this=0x7fff12fc5f40) at /home/aga/CSV/kmymoney/kmymoney/mymoney/mymoneyfile.cpp:2703
#23 0x00000000004da444 in KReportsView::slotConfigure (this=0x13fc0b0) at /home/aga/CSV/kmymoney/kmymoney/views/kreportsview.cpp:769
#24 0x00000000004e1eb5 in KReportsView::qt_metacall (this=0x13fc0b0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff12fc6090) at /home/aga/CSV/kmymoney/build/kmymoney/views/kreportsview.moc:119
#25 0x00007f49f93f1def in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#26 0x00007f49f8b9ba32 in QAbstractButton::clicked(bool) () from /usr/lib64/libQtGui.so.4
#27 0x00007f49f88e3d9b in ?? () from /usr/lib64/libQtGui.so.4
#28 0x00007f49f88e535b in ?? () from /usr/lib64/libQtGui.so.4
#29 0x00007f49f88e55cc in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libQtGui.so.4
#30 0x00007f49f8582538 in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#31 0x00007f49f8530d14 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#32 0x00007f49f8539aac in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#33 0x00007f49fb62c9e6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#34 0x00007f49f93dcbfc in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#35 0x00007f49f8531d25 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQtGui.so.4
#36 0x00007f49f85afe08 in ?? () from /usr/lib64/libQtGui.so.4
#37 0x00007f49f85ae4c9 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4
#38 0x00007f49f85d60f2 in ?? () from /usr/lib64/libQtGui.so.4
#39 0x00007f49f23efbd3 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#40 0x00007f49f23f03b0 in ?? () from /lib64/libglib-2.0.so.0
#41 0x00007f49f23f0650 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#42 0x00007f49f940791f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#43 0x00007f49f85d5d8e in ?? () from /usr/lib64/libQtGui.so.4
#44 0x00007f49f93dc052 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#45 0x00007f49f93dc265 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#46 0x00007f49f93e06ab in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4
#47 0x000000000045a31e in main (argc=1, argv=0x7fff12fc8268) at /home/aga/CSV/kmymoney/kmymoney/main.cpp:260

Reported using DrKonqi
Comment 1 allan 2011-04-28 11:51:55 UTC
Without changing the start date (3 Mar 2010) -
  Change end date to 27 Mar 2011 (from 27 Apr 2011) - Completes OK.
  Then change end date to 31 Mar 2011 - Crashes.

If I change end date to 28 Mar 2011 (from 27 Mar 2011) - Completes OK.
  Then change end date to 29 Mar 2011 - Crashes.
Comment 2 allan 2011-04-28 17:45:24 UTC
Without changing the start date (3 Mar 2010) -
  Change end date to 27 Mar 2011 (from 27 Apr 2011) - Completes OK.
  Then change end date to 31 Mar 2011 - Crashes.

If I change end date to 28 Mar 2011 (from 27 Mar 2011) - Completes OK.
  Then change end date to 29 Mar 2011 - Crashes.
(In reply to comment #1)
> Without changing the start date (3 Mar 2010) -
>   Change end date to 27 Mar 2011 (from 27 Apr 2011) - Completes OK.
>   Then change end date to 31 Mar 2011 - Crashes.
> 
> If I change end date to 28 Mar 2011 (from 27 Mar 2011) - Completes OK.
>   Then change end date to 29 Mar 2011 - Crashes.

(In reply to comment #1)
> Without changing the start date (3 Mar 2010) -
>   Change end date to 27 Mar 2011 (from 27 Apr 2011) - Completes OK.
>   Then change end date to 31 Mar 2011 - Crashes.
> 
> If I change end date to 28 Mar 2011 (from 27 Mar 2011) - Completes OK.
>   Then change end date to 29 Mar 2011 - Crashes.

I had a peep at the code and saw that at the point of crash it was performing the calculations, not getting the new date.  So I checked my data.  I disabled all accounts and readded them one by one.  Needless to say, the last one was the culprit.

My fund manager had decided to close down my original fund and incopporate it in a larger one.  Previosly, I've handled this by a remove transaction followed by an add transaction, but concerned that that might affect performance reporting, this time, I did a sell and a buy, on the same day, and within the same investment account.  The date was the 28 Mar., the last date that didn't cause a crash.

So, I suspect that the crash occurred on handling the transaction for the new fund on the day following the purchase, which was the end-date of the report.
Comment 3 allan 2011-04-29 00:46:02 UTC
Apart from how the error condition is handled, I think the root cause is that in the Buy transaction on 28 Mar, the price was not added to the prices table, which has been noted before.  The first price entry for the security is for 1 Apr.  Manually adding the price for 28 Mar allows the report to be produced.
Comment 4 Cristian Oneț 2011-05-05 22:17:18 UTC
Allan could you please provide an anonymous file to reproduce this? The setup to reproduce this bug looks pretty laborious :). And having an anonymous file where I could go directly and reproduce the crash would make fixing this a lot easier. Thanks!
Comment 5 allan 2011-05-05 23:25:53 UTC
(In reply to comment #4)
> Allan could you please provide an anonymous file to reproduce this? The setup
> to reproduce this bug looks pretty laborious :). And having an anonymous file
> where I could go directly and reproduce the crash would make fixing this a lot
> easier. Thanks!

I've started to do that but another crash has intervened.  It's probably related, but occurred on selecting the report, before any configuring could be done.  I'd invented some transactions and before doing the report, I decided to save.  The save baulked on the consistency check, objecting to the lack of opening prices on unconnected dates.  Here's the BT in case it helps.  I'll have another try next.

Application: KMyMoney (kmymoney), signal: Floating point exception
[KCrash Handler]
#6  0x00007f970e36617b in raise () from /lib64/libpthread.so.0
#7  0x00007f970b4b551e in __gmp_invalid_operation () from /usr/lib64/libgmp.so.10
#8  0x00007f970b4d160f in __gmpq_set_d () from /usr/lib64/libgmp.so.10
#9  0x00007f970e9d1537 in operator= (this=0x7fff7460a9a0, dAmount=@0x7fff7460a818, denom=10000) at /usr/include/gmpxx.h:1808
#10 AlkValue::AlkValue (this=0x7fff7460a9a0, dAmount=@0x7fff7460a818, denom=10000) at /home/aga/libalkimia-4.3.0/alkvalue.cpp:117
#11 0x00000000005711ba in MyMoneyMoney (this=0x230e680, account=..., result=...) at /home/aga/CSV/kmymoney/kmymoney/mymoney/mymoneymoney.h:266
#12 reports::QueryTable::constructPerformanceRow (this=0x230e680, account=..., result=...) at /home/aga/CSV/kmymoney/kmymoney/reports/querytable.cpp:1041
#13 0x000000000057eb4b in reports::QueryTable::constructAccountTable (this=0x230e680) at /home/aga/CSV/kmymoney/kmymoney/reports/querytable.cpp:1128
#14 0x000000000057f309 in reports::QueryTable::init (this=0x230e680) at /home/aga/CSV/kmymoney/kmymoney/reports/querytable.cpp:262
#15 0x000000000057fe7f in reports::QueryTable::QueryTable (this=0x230e680, _report=<value optimized out>) at /home/aga/CSV/kmymoney/kmymoney/reports/querytable.cpp:252
#16 0x00000000004db6f9 in KReportsView::KReportTab::updateReport (this=0x12b0060) at /home/aga/CSV/kmymoney/kmymoney/views/kreportsview.cpp:183
#17 0x00000000004db7e2 in KReportsView::KReportTab::showEvent (this=0x12b0060, event=<value optimized out>) at /home/aga/CSV/kmymoney/kmymoney/views/kreportsview.cpp:159
#18 0x00007f970c4247f5 in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#19 0x00007f970c3d2d14 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#20 0x00007f970c3db22a in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#21 0x00007f970f4ce9e6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#22 0x00007f970d27ebfc in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#23 0x00007f970c427e6f in QWidgetPrivate::show_helper() () from /usr/lib64/libQtGui.so.4
#24 0x00007f970c42819a in QWidget::setVisible(bool) () from /usr/lib64/libQtGui.so.4
#25 0x00007f970c408e59 in QStackedLayout::setCurrentIndex(int) () from /usr/lib64/libQtGui.so.4
#26 0x00007f970c830323 in ?? () from /usr/lib64/libQtGui.so.4
#27 0x00007f970c8305e0 in QTabWidget::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib64/libQtGui.so.4
#28 0x00007f970f56c905 in KTabWidget::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib64/libkdeui.so.5
#29 0x00007f970d293def in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#30 0x00007f970c825d6e in QTabBar::currentChanged(int) () from /usr/lib64/libQtGui.so.4
#31 0x00000000004e1e23 in KReportsView::qt_metacall (this=0x1353560, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff7460c320) at /home/aga/CSV/kmymoney/build/kmymoney/views/kreportsview.moc:122
#32 0x00007f970d293def in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#33 0x00007f970c94fa40 in QTreeWidget::itemDoubleClicked(QTreeWidgetItem*, int) () from /usr/lib64/libQtGui.so.4
#34 0x00007f970c957f6b in QTreeWidget::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib64/libQtGui.so.4
#35 0x00007f970d293def in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#36 0x00007f970c8db465 in QAbstractItemView::doubleClicked(QModelIndex const&) () from /usr/lib64/libQtGui.so.4
#37 0x00007f970c9218db in QTreeView::mouseDoubleClickEvent(QMouseEvent*) () from /usr/lib64/libQtGui.so.4
#38 0x00007f970c424552 in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#39 0x00007f970c7c8906 in QFrame::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#40 0x00007f970c8d8c23 in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib64/libQtGui.so.4
#41 0x00007f970c91da85 in QTreeView::viewportEvent(QEvent*) () from /usr/lib64/libQtGui.so.4
#42 0x00007f970d27ed87 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#43 0x00007f970c3d2ce1 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#44 0x00007f970c3dbaac in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#45 0x00007f970f4ce9e6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#46 0x00007f970d27ebfc in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#47 0x00007f970c3d3d25 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQtGui.so.4
#48 0x00007f970c451e08 in ?? () from /usr/lib64/libQtGui.so.4
#49 0x00007f970c4504c9 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4
#50 0x00007f970c4780f2 in ?? () from /usr/lib64/libQtGui.so.4
#51 0x00007f9706291bd3 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#52 0x00007f97062923b0 in ?? () from /lib64/libglib-2.0.so.0
#53 0x00007f9706292650 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#54 0x00007f970d2a991f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#55 0x00007f970c477d8e in ?? () from /usr/lib64/libQtGui.so.4
#56 0x00007f970d27e052 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#57 0x00007f970d27e265 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#58 0x00007f970d2826ab in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4
#59 0x000000000045a37e in main (argc=1, argv=0x7fff7460ea68) at /home/aga/CSV/kmymoney/kmymoney/main.cpp:260
Comment 6 allan 2011-05-06 01:21:44 UTC
This current crash is reproducible.  The first time, I used existing accounts, removed any transactions and prices.  This time I deleted the security account, and added two new stocks.  In the first, securityA, I did an add of 100 on 20 Apr. Then I sold those @ price 1 on 28 Apr.  Then I bought 50 securityB @ price 2 on the same day.  When I tried to do an Investment report by account, KMM crashed immediately.  A consistency check objected to the lack of a price for both securities on or prior to today, 5 May.  So. although I'd entered prices for both for 28 Apr, these were not in the prices table, hence the consistency alert, and possibly, the crash.

I'll now try to produce a file with a price manually added for 28 Apr. for securityA, and on 1 May for securityB, to satisfy the consistency check.  The consistency check doesn't object, but the crash still happens. Now, I'll manually add a price for  securityB for 28 Apr.  Still it crashes.  The only way I found to avoid the crash was to select a different report type and change the 'to date' to 6 Apr, before the security transactions.

OK, now I have a file.  If you change the 'to date' to 28 Apr, the crash occurs.
I'll send the file privately.  As far as I can see, it's valid.
Comment 7 Cristian Oneț 2011-05-06 07:09:26 UTC
I just wanted to confirm that the file did the trick, now I can reproduce the crash. I'll fix it later today.
Comment 8 Cristian Oneț 2011-05-06 21:09:11 UTC
SVN commit 1230731 by conet:

BUG: 271914
When XIRR returns Nan display 0% instead of issuing an arithmetic exception.

 M  +6 -1      querytable.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1230731