Bug 312676

Summary: Crash when creating a report
Product: [Applications] kmymoney Reporter: wolfgang.bachleitner
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: crash CC: edgaralwers, justin, nicolasb.info, onet.cristian
Priority: NOR    
Version: 4.6.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: This is my anonimized datafile. I exported it from my mysql instance

Description wolfgang.bachleitner 2013-01-05 13:02:47 UTC
Application: kmymoney (4.6.3)
KDE Platform Version: 4.9.3
Qt Version: 4.8.3
Operating System: Linux 3.5.0-21-generic x86_64
Distribution: Ubuntu 12.10

-- Information about the crash:
- What I was doing when the application crashed:
I tryed to open a report when kmymoney crashed without any notice

-- Backtrace:
Application: KMyMoney (kmymoney), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f9ff24d7780 (LWP 1738))]

Thread 3 (Thread 0x7f9fda002700 (LWP 1739)):
#0  0x00007f9fef6bdd2d in read () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9fe810915f in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f9fe80cc914 in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f9fe80ccd22 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f9fe80ccea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f9fee5aac16 in QEventDispatcherGlib::processEvents (this=0x7f9fd40008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#6  0x00007f9fee57b2bf in QEventLoop::processEvents (this=this@entry=0x7f9fda001dd0, flags=...) at kernel/qeventloop.cpp:149
#7  0x00007f9fee57b548 in QEventLoop::exec (this=0x7f9fda001dd0, flags=...) at kernel/qeventloop.cpp:204
#8  0x00007f9fee47cb10 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#9  0x00007f9fee55b9af in QInotifyFileSystemWatcherEngine::run (this=0x172e730) at io/qfilesystemwatcher_inotify.cpp:248
#10 0x00007f9fee47faec in QThreadPrivate::start (arg=0x172e730) at thread/qthread_unix.cpp:338
#11 0x00007f9fef6b6e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#12 0x00007f9fec9fccbd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#13 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f9fd1d85700 (LWP 1816)):
#0  0x00007fffbcfff65e in clock_gettime ()
#1  0x00007f9fe838015d in clock_gettime () from /lib/x86_64-linux-gnu/librt.so.1
#2  0x00007f9fee4d59c4 in do_gettime (frac=0x7f9fd1d84b28, sec=0x7f9fd1d84b20) at tools/qelapsedtimer_unix.cpp:123
#3  qt_gettime () at tools/qelapsedtimer_unix.cpp:140
#4  0x00007f9fee5ab41d in QTimerInfoList::updateCurrentTime (this=this@entry=0x7f9fcc001250) at kernel/qeventdispatcher_unix.cpp:343
#5  0x00007f9fee5ab763 in QTimerInfoList::timerWait (this=0x7f9fcc001250, tm=...) at kernel/qeventdispatcher_unix.cpp:450
#6  0x00007f9fee5aa2cc in timerSourcePrepareHelper (src=<optimized out>, timeout=0x7f9fd1d84c14) at kernel/qeventdispatcher_glib.cpp:136
#7  0x00007f9fee5aa375 in timerSourcePrepare (source=<optimized out>, timeout=<optimized out>) at kernel/qeventdispatcher_glib.cpp:169
#8  0x00007f9fe80cc618 in g_main_context_prepare () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#9  0x00007f9fe80cccab in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007f9fe80ccea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#11 0x00007f9fee5aac16 in QEventDispatcherGlib::processEvents (this=0x7f9fcc002b00, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#12 0x00007f9fee57b2bf in QEventLoop::processEvents (this=this@entry=0x7f9fd1d84dd0, flags=...) at kernel/qeventloop.cpp:149
#13 0x00007f9fee57b548 in QEventLoop::exec (this=0x7f9fd1d84dd0, flags=...) at kernel/qeventloop.cpp:204
#14 0x00007f9fee47cb10 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#15 0x00007f9fee55b9af in QInotifyFileSystemWatcherEngine::run (this=0x1febc30) at io/qfilesystemwatcher_inotify.cpp:248
#16 0x00007f9fee47faec in QThreadPrivate::start (arg=0x1febc30) at thread/qthread_unix.cpp:338
#17 0x00007f9fef6b6e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#18 0x00007f9fec9fccbd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#19 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f9ff24d7780 (LWP 1738)):
[KCrash Handler]
#5  0x000000000057efc9 in reports::PivotCell::operator+= (this=0x0, value=...) at /build/buildd/kmymoney-4.6.3/kmymoney/reports/pivotgrid.cpp:55
#6  0x000000000055da93 in reports::PivotTable::assignCell (this=this@entry=0x611a2a0, outergroup=..., _row=..., column=column@entry=-23, value=..., budget=budget@entry=false, stockSplit=stockSplit@entry=false) at /build/buildd/kmymoney-4.6.3/kmymoney/reports/pivottable.cpp:1226
#7  0x0000000000555f84 in reports::PivotTable::init (this=this@entry=0x611a2a0) at /build/buildd/kmymoney-4.6.3/kmymoney/reports/pivottable.cpp:326
#8  0x0000000000557409 in reports::PivotTable::PivotTable (this=0x611a2a0, _config_f=...) at /build/buildd/kmymoney-4.6.3/kmymoney/reports/pivottable.cpp:94
#9  0x00000000004cafa1 in KReportsView::KReportTab::updateReport (this=0x313c200) at /build/buildd/kmymoney-4.6.3/kmymoney/views/kreportsview.cpp:181
#10 0x00000000004cb0f4 in KReportsView::KReportTab::loadTab (this=<optimized out>) at /build/buildd/kmymoney-4.6.3/kmymoney/views/kreportsview.cpp:151
#11 0x00000000004d36c1 in KReportsView::loadView (this=0x19c0e90) at /build/buildd/kmymoney-4.6.3/kmymoney/views/kreportsview.cpp:550
#12 0x00000000004d3f2d in KReportsView::slotLoadView (this=0x19c0e90) at /build/buildd/kmymoney-4.6.3/kmymoney/views/kreportsview.cpp:366
#13 0x00007f9fee591f5f in QMetaObject::activate (sender=0x7f9ff22efae0 <MyMoneyFile::file>, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3547
#14 0x00007f9ff208c1b9 in MyMoneyFile::commitTransaction (this=this@entry=0x7f9ff22efae0 <MyMoneyFile::file>) at /build/buildd/kmymoney-4.6.3/kmymoney/mymoney/mymoneyfile.cpp:423
#15 0x00007f9ff208c2d5 in MyMoneyFileTransaction::commit (this=0x7fffbced1e40) at /build/buildd/kmymoney-4.6.3/kmymoney/mymoney/mymoneyfile.cpp:2832
#16 0x00000000004cc8b7 in KReportsView::slotConfigure (this=0x19c0e90) at /build/buildd/kmymoney-4.6.3/kmymoney/views/kreportsview.cpp:770
#17 0x00007f9fee591f5f in QMetaObject::activate (sender=0x60eb090, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffbced23b0) at kernel/qobject.cpp:3547
#18 0x00007f9fedd13422 in QAbstractButton::clicked (this=<optimized out>, _t1=false) at .moc/release-shared/moc_qabstractbutton.cpp:220
#19 0x00007f9feda66d2e in QAbstractButtonPrivate::emitClicked (this=this@entry=0x60eb0c0) at widgets/qabstractbutton.cpp:548
#20 0x00007f9feda67560 in QAbstractButtonPrivate::click (this=this@entry=0x60eb0c0) at widgets/qabstractbutton.cpp:541
#21 0x00007f9feda677cc in QAbstractButton::mouseReleaseEvent (this=0x60eb090, e=0x7fffbced2c50) at widgets/qabstractbutton.cpp:1123
#22 0x00007f9fed6f8850 in QWidget::event (this=0x60eb090, event=0x7fffbced2c50) at kernel/qwidget.cpp:8371
#23 0x00007f9fed6a8e9c in QApplicationPrivate::notify_helper (this=this@entry=0xef2490, receiver=receiver@entry=0x60eb090, e=e@entry=0x7fffbced2c50) at kernel/qapplication.cpp:4562
#24 0x00007f9fed6adb6b in QApplication::notify (this=<optimized out>, receiver=0x60eb090, e=0x7fffbced2c50) at kernel/qapplication.cpp:4105
#25 0x00007f9ff0b271d6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#26 0x00007f9fee57c56e in QCoreApplication::notifyInternal (this=0xee1740, receiver=0x60eb090, event=0x7fffbced2c50) at kernel/qcoreapplication.cpp:915
#27 0x00007f9fed6a9cd3 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#28 QApplicationPrivate::sendMouseEvent (receiver=0x60eb090, event=0x7fffbced2c50, alienWidget=0x60eb090, nativeWidget=0x19c0e90, buttonDown=0x7f9fee185308 <qt_button_down>, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3173
#29 0x00007f9fed727554 in QETWidget::translateMouseEvent (this=this@entry=0x19c0e90, event=event@entry=0x7fffbced33d0) at kernel/qapplication_x11.cpp:4622
#30 0x00007f9fed72644f in QApplication::x11ProcessEvent (this=0xee1740, event=0x7fffbced33d0) at kernel/qapplication_x11.cpp:3737
#31 0x00007f9fed74dfa2 in x11EventSourceDispatch (s=0xef5170, callback=0x0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#32 0x00007f9fe80ccab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007f9fe80ccde8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007f9fe80ccea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007f9fee5aabf6 in QEventDispatcherGlib::processEvents (this=0xebaad0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#36 0x00007f9fed74dc1e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#37 0x00007f9fee57b2bf in QEventLoop::processEvents (this=this@entry=0x7fffbced37a0, flags=...) at kernel/qeventloop.cpp:149
#38 0x00007f9fee57b548 in QEventLoop::exec (this=0x7fffbced37a0, flags=...) at kernel/qeventloop.cpp:204
#39 0x00007f9fee580708 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#40 0x0000000000457dd6 in runKMyMoney (splash=splash@entry=0x1080140, a=0xee1740) at /build/buildd/kmymoney-4.6.3/kmymoney/main.cpp:282
#41 0x000000000045659f in main (argc=1, argv=0x7fffbced4298) at /build/buildd/kmymoney-4.6.3/kmymoney/main.cpp:181

Possible duplicates by query: bug 308399.

Reported using DrKonqi
Comment 1 Alvaro Soliverez 2013-01-05 14:53:04 UTC
What type of report were you trying to create?
Comment 2 wolfgang.bachleitner 2013-01-13 15:31:56 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It does not matter which report. It also happens if I try to open
a predefined report. E.G. "Einnahmen und Ausgaben, aktuelles Jahr".
I cannot open any report

yours

Wolfgang Bachleitner
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJQ8tNiAAoJEKdCGcuse478SjEIAJwbKM39gSvTGAnadaJ1BPmm
S2TUj9Jk541p/LYIpR9BHoYodVcne9Yp9tc67A27LUYczuZDVsClCYl8hGpW7a+L
8WMkWGfQoepp7gbWw5PXBV0M6rsct8V+sLzHUg1Uk/gJ5UQURnQ27X1Ab26nhGZB
ZAR9tnH30XfNQGLWPpKEPOsdFcKfARAPkyY395/+daBkbrsVuaYWem5FilFZt3Nu
PB73OazmRwWIINBHP0t/viEleBb8XzBIf/BwYlpTWT4a4XcGgxCV3QVP9dtUJBga
jbwvGyfCDA9f/Q/p1aPwi7e1h/rZTW2i7qnoDNKZgf/WssKjRZ/0/LqpLqpg+aE=
=5emf
-----END PGP SIGNATURE-----
Comment 3 Thomas Baumgart 2013-01-13 16:06:15 UTC
Could it be a duplicate of bug 282107 which has already been fixed in master?
Comment 4 wolfgang.bachleitner 2013-01-13 17:24:23 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I updated from a 4.5 version, where I did not have this problem.
Since I am using the version 4.6.3 this crash happens!

Thank you for your answer

yours
Wolfgang Bachleitner
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJQ8u2+AAoJEKdCGcuse478nbEH/0LesNLYa/K86dtYgYhEIOln
TwE7owgxgplGcSw+a4q8XcU+nHdOLOp4SuLPJ3cO4rVeyqJhOrrEalw/YsbpU54D
VFOAMsEdqZci9r+osLDN9zoBxmfr4ZVT8jpEJ5RTlxB0oQviiAUUEtfbka8uzT5F
JO3c3GQZK4GEttjbGKMWBfAX12Lv9bnMwNddw0XPqSZPA+gg4HRZtMWTL5BIb5Ea
PIbB9umVMmbFMgkXH39c0sqg8zc9RyymMqrzh5lMs0BOvKUqJ/s1BcF6KuTrreXu
tUp40TaII/yyTclLaDJd2AkUDGimsTDRtIHaWvytMwd5+1OOPbh3i1TwqxMTfFU=
=EBh9
-----END PGP SIGNATURE-----
Comment 5 Cristian Oneț 2013-01-26 09:46:31 UTC
*** Bug 313331 has been marked as a duplicate of this bug. ***
Comment 6 Cristian Oneț 2013-01-26 09:47:15 UTC
Could we get an anonymous file to reproduce this?
Comment 7 Christoph Feck 2013-02-02 00:08:51 UTC
If you can provide the information requested in comment #6, please add it.
Comment 8 nicolasb.info 2013-02-05 23:14:09 UTC
Created attachment 76935 [details]
This is my anonimized datafile. I exported it from my mysql instance
Comment 9 nicolasb.info 2013-02-05 23:36:28 UTC
Comment on attachment 76935 [details]
This is my anonimized datafile. I exported it from my mysql instance

In order to reproduce te bug with this attachment

1) open kmm with my datafile
2) Export to mysql
3) Open kmm connecting t mysql database containing my datafile
4) open "Valor neto desde 2/9/2011, base mensual" report
5) on the report screen, click on new
6) go to date tab, and change the interval to 'last 12 months' 
7) Save the new report
Comment 10 Cristian Oneț 2013-02-13 06:20:01 UTC
I can confirm this. Before crashing there was this DB error message:

Nu se poate adăuga raportul, motivul: "Error in function void MyMoneyStorageSql::writeReport(const MyMoneyReport&, QSqlQuery&) : writing Reports
Driver = QSQLITE, Host = localhost, User = cristi, Database = /home/cristi/dezvoltare/testfiles/mysql
Driver Error: 
Database Error No -1: 
Text:  
Error type 0
Executed: INSERT INTO kmmReportConfig (name, XML, id) VALUES (?, ?, ?);
Query error No 19: column id is not unique Imposibil de preluat rîndul
Error type 1"
Comment 11 Cristian Oneț 2013-08-30 10:35:10 UTC
Git commit cad7ecbccda1d2b96122bd1fb8bb4a37d6c4f8e9 by Cristian Oneț.
Committed on 30/08/2013 at 10:25.
Pushed by conet into branch 'master'.

Fix a crash in reports using the mysql storage backend.

This crash was caused by the fact that the report, after requesting
the transaction list, did not check that the transactions are inside
the requested date interval. Since the date is used to compute an
index in a columns list a date outside the requested interval would
cause an invalid index to be computed and causing the crash.

Now the report performs a validity check of the date after filtering
the transactions.

Also fixed the SQL backend implementation to properly filter by dates
even if an empty split filter is provided. Also added a testcase for
this scenario.

M  +15   -0    kmymoney/mymoney/storage/mymoneydatabasemgrtest.cpp
M  +2    -2    kmymoney/mymoney/storage/mymoneystoragesql.cpp
M  +7    -3    kmymoney/reports/pivottable.cpp

http://commits.kde.org/kmymoney/cad7ecbccda1d2b96122bd1fb8bb4a37d6c4f8e9
Comment 12 Cristian Oneț 2013-08-30 10:35:54 UTC
Git commit 03012f548a6501138e31b86853eb2dc6a4cccefe by Cristian Oneț.
Committed on 30/08/2013 at 10:25.
Pushed by conet into branch '4.6'.

Fix a crash in reports using the mysql storage backend.

This crash was caused by the fact that the report, after requesting
the transaction list, did not check that the transactions are inside
the requested date interval. Since the date is used to compute an
index in a columns list a date outside the requested interval would
cause an invalid index to be computed and causing the crash.

Now the report performs a validity check of the date after filtering
the transactions.

Also fixed the SQL backend implementation to properly filter by dates
even if an empty split filter is provided. Also added a testcase for
this scenario.
(cherry picked from commit cad7ecbccda1d2b96122bd1fb8bb4a37d6c4f8e9)

M  +15   -0    kmymoney/mymoney/storage/mymoneydatabasemgrtest.cpp
M  +2    -2    kmymoney/mymoney/storage/mymoneystoragesql.cpp
M  +7    -3    kmymoney/reports/pivottable.cpp

http://commits.kde.org/kmymoney/03012f548a6501138e31b86853eb2dc6a4cccefe
Comment 13 Cristian Oneț 2013-09-12 08:45:17 UTC
*** Bug 318472 has been marked as a duplicate of this bug. ***
Comment 14 Cristian Oneț 2013-09-12 08:48:00 UTC
*** Bug 322463 has been marked as a duplicate of this bug. ***
Comment 15 Cristian Oneț 2014-07-29 10:06:04 UTC
*** Bug 327265 has been marked as a duplicate of this bug. ***