Bug 253099

Summary: KMyMoney crashes upon loading exported file from Skrooge
Product: [Applications] kmymoney Reporter: Vit Pelcak <vit>
Component: generalAssignee: Vit Pelcak <vit>
Status: RESOLVED FIXED    
Severity: crash CC: stephane, tbaumgart
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: testing exported file from Skrooge

Description Vit Pelcak 2010-10-03 09:49:23 UTC
Application: kmymoney (4.5.0)
KDE Platform Version: 4.5.1 (KDE 4.5.1)
Qt Version: 4.7.0
Operating System: Linux 2.6.32-25-generic x86_64
Distribution: Ubuntu 10.04.1 LTS

-- Information about the crash:
- What I was doing when the application crashed:
I have account in Skrooge. I have exported it for KmyMoney.

Then I tried to open it in KmyMoney, but it crashed.

I hope that backtracer is enough for you to figure out or you are able to reproduce that bug as I'm not too eager to share my personal data by sending file which crashes for me.

The crash can be reproduced every time.

-- Backtrace:
Application: KMyMoney (kmymoney), signal: Aborted
[Current thread is 1 (Thread 0x7fabf594d760 (LWP 10332))]

Thread 2 (Thread 0x7fabdbd44710 (LWP 10333)):
#0  0x00007fabf030ffb3 in *__GI___poll (fds=<value optimized out>, nfds=<value optimized out>, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007fabeabef4a9 in ?? () from /lib/libglib-2.0.so.0
#2  0x00007fabeabef8fc in g_main_context_iteration () from /lib/libglib-2.0.so.0
#3  0x00007fabf117d1d6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007fabf114fdd2 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007fabf11501bc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007fabf105b36d in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007fabf112fb48 in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007fabf105e2ee in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007fabf2d599ca in start_thread (arg=<value optimized out>) at pthread_create.c:300
#10 0x00007fabf031c72d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fabf594d760 (LWP 10332)):
[KCrash Handler]
#6  0x00007fabf0269a75 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00007fabf026d5c0 in *__GI_abort () at abort.c:92
#8  0x00007fabf0b1f8e5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#9  0x00007fabf0b1dd16 in ?? () from /usr/lib/libstdc++.so.6
#10 0x00007fabf0b1cc09 in ?? () from /usr/lib/libstdc++.so.6
#11 0x00007fabf0b1d6b1 in __gxx_personality_v0 () from /usr/lib/libstdc++.so.6
#12 0x00007fabf05c98a3 in _Unwind_RaiseException_Phase2 (exc=0x17c1740, context=0x7fffbb1f8e20) at ../../../src/libgcc/../gcc/unwind.inc:62
#13 0x00007fabf05c9bcd in _Unwind_RaiseException (exc=0x17c1740) at ../../../src/libgcc/../gcc/unwind.inc:131
#14 0x00007fabf0b1de31 in __cxa_throw () from /usr/lib/libstdc++.so.6
#15 0x00007fabf551ea8c in MyMoneyFile::checkTransaction (this=<value optimized out>, txt=<value optimized out>) at /build/buildd/kmymoney-4.5/kmymoney/mymoney/mymoneyfile.cpp:148
#16 0x00007fabf551ebd0 in MyMoneyFile::rollbackTransaction (this=0x285c) at /build/buildd/kmymoney-4.5/kmymoney/mymoney/mymoneyfile.cpp:166
#17 0x00007fabf551ec06 in MyMoneyFileTransaction::rollback (this=0x7fffbb1f9820) at /build/buildd/kmymoney-4.5/kmymoney/mymoney/mymoneyfile.cpp:2415
#18 0x00000000004cf3c0 in KMyMoneyView::readFile (this=0x16f8cb0, url=<value optimized out>) at /build/buildd/kmymoney-4.5/kmymoney/views/kmymoneyview.cpp:803
#19 0x0000000000493959 in KMyMoneyApp::slotFileOpenRecent (this=<value optimized out>, url=<value optimized out>) at /build/buildd/kmymoney-4.5/kmymoney/kmymoney.cpp:1502
#20 0x0000000000494828 in KMyMoneyApp::slotFileOpen (this=0x14c8f30) at /build/buildd/kmymoney-4.5/kmymoney/kmymoney.cpp:1407
#21 0x00000000004a1b5d in KMyMoneyApp::qt_metacall (this=0x14c8f30, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffbb1fa500)
    at /build/buildd/kmymoney-4.5/obj-x86_64-linux-gnu/kmymoney/kmymoney.moc:513
#22 0x00007fabf1168da7 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#23 0x00007fabf1b1a002 in QAction::triggered(bool) () from /usr/lib/libQtGui.so.4
#24 0x00007fabf1b1b6fb in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQtGui.so.4
#25 0x00007fabf1ef62da in ?? () from /usr/lib/libQtGui.so.4
#26 0x00007fabf1ef658c in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#27 0x00007fabf1fc54fa in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#28 0x00007fabf1b7748e in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#29 0x00007fabf1b216ec in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#30 0x00007fabf1b279fe in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#31 0x00007fabf3f7c536 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#32 0x00007fabf11510ac in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#33 0x00007fabf1b264ae in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#34 0x00007fabf1ba94a5 in ?? () from /usr/lib/libQtGui.so.4
#35 0x00007fabf1ba7ddc in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#36 0x00007fabf1bd4012 in ?? () from /usr/lib/libQtGui.so.4
#37 0x00007fabeabeb8c2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#38 0x00007fabeabef748 in ?? () from /lib/libglib-2.0.so.0
#39 0x00007fabeabef8fc in g_main_context_iteration () from /lib/libglib-2.0.so.0
#40 0x00007fabf117d183 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#41 0x00007fabf1bd397e in ?? () from /usr/lib/libQtGui.so.4
#42 0x00007fabf114fdd2 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#43 0x00007fabf11501bc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#44 0x00007fabf115426b in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#45 0x0000000000457898 in main (argc=<value optimized out>, argv=<value optimized out>) at /build/buildd/kmymoney-4.5/kmymoney/main.cpp:260

Reported using DrKonqi
Comment 1 Cristian Oneț 2010-10-28 22:56:35 UTC
Could you please reproduce this with a Skrooge test file since it could be a problem in their export procedure (that they don't generate a valid kmymoney file) and please attach it to this bug.
Comment 2 Vit Pelcak 2010-11-14 10:23:26 UTC
Created attachment 53405 [details]
testing exported file from Skrooge

I cannot reproduce this problem with Skrooge empty file.

I have created file which is not empty and crashes KMyMoney.

Backtrace:

Application: KMyMoney (kmymoney), signal: Aborted
[Current thread is 1 (Thread 0x7f1c526fc760 (LWP 4771))]

Thread 3 (Thread 0x7f1c38c41710 (LWP 4772)):
#0  0x00007f1c4d0c21d3 in poll () from /lib/libc.so.6
#1  0x00007f1c4821d009 in ?? () from /lib/libglib-2.0.so.0
#2  0x00007f1c4821d45c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#3  0x00007f1c4df1a1e6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007f1c4deeca02 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007f1c4deecdec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007f1c4ddf72fd in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007f1c4decc5f8 in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007f1c4ddfa27e in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f1c4fd20971 in start_thread () from /lib/libpthread.so.0
#10 0x00007f1c4d0ce91d in clone () from /lib/libc.so.6
#11 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f1c30bdd710 (LWP 4773)):
#0  0x00007f1c4fd24e09 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f1c4ddfada2 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007f1c4ddefda2 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007f1c4ddfa27e in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007f1c4fd20971 in start_thread () from /lib/libpthread.so.0
#5  0x00007f1c4d0ce91d in clone () from /lib/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f1c526fc760 (LWP 4771)):
[KCrash Handler]
#6  0x00007f1c4d01bba5 in raise () from /lib/libc.so.6
#7  0x00007f1c4d01f6b0 in abort () from /lib/libc.so.6
#8  0x00007f1c4d8bf6bd in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
#9  0x00007f1c4d8bd906 in ?? () from /usr/lib/libstdc++.so.6
#10 0x00007f1c4d8bc8d9 in ?? () from /usr/lib/libstdc++.so.6
#11 0x00007f1c4d8bd1f5 in __gxx_personality_v0 () from /usr/lib/libstdc++.so.6
#12 0x00007f1c4d37a49b in ?? () from /lib/libgcc_s.so.1
#13 0x00007f1c4d37a72d in _Unwind_RaiseException () from /lib/libgcc_s.so.1
#14 0x00007f1c4d8bda31 in __cxa_throw () from /usr/lib/libstdc++.so.6
#15 0x00007f1c522c564c in MyMoneyFile::checkTransaction (this=<value optimized out>, txt=<value optimized out>) at /build/buildd/kmymoney-4.5/kmymoney/mymoney/mymoneyfile.cpp:148
#16 0x00007f1c522c5790 in MyMoneyFile::rollbackTransaction (this=0x12a3) at /build/buildd/kmymoney-4.5/kmymoney/mymoney/mymoneyfile.cpp:166
#17 0x00007f1c522c57c6 in MyMoneyFileTransaction::rollback (this=0x7ffff77ecff0) at /build/buildd/kmymoney-4.5/kmymoney/mymoney/mymoneyfile.cpp:2415
#18 0x00000000004ce97c in KMyMoneyView::readFile (this=0x239cc80, url=<value optimized out>) at /build/buildd/kmymoney-4.5/kmymoney/views/kmymoneyview.cpp:803
#19 0x0000000000496299 in KMyMoneyApp::slotFileOpenRecent (this=<value optimized out>, url=<value optimized out>) at /build/buildd/kmymoney-4.5/kmymoney/kmymoney.cpp:1502
#20 0x0000000000497198 in KMyMoneyApp::slotFileOpen (this=0x20d4fd0) at /build/buildd/kmymoney-4.5/kmymoney/kmymoney.cpp:1407
#21 0x000000000049e71d in KMyMoneyApp::qt_metacall (this=0x20d4fd0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7ffff77edcd0) at /build/buildd/kmymoney-4.5/obj-x86_64-linux-gnu/kmymoney/kmymoney.moc:513
#22 0x00007f1c4df05b27 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#23 0x00007f1c4e89c852 in QAction::triggered(bool) () from /usr/lib/libQtGui.so.4
#24 0x00007f1c4e89df5b in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQtGui.so.4
#25 0x00007f1c4ec7d57a in ?? () from /usr/lib/libQtGui.so.4
#26 0x00007f1c4ec7d82c in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#27 0x00007f1c4ed4d52a in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#28 0x00007f1c4e8fa04e in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#29 0x00007f1c4e8a3fdc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#30 0x00007f1c4e8aa30e in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#31 0x00007f1c50d25526 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#32 0x00007f1c4deedcdc in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#33 0x00007f1c4e8a8dbe in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#34 0x00007f1c4e92c345 in ?? () from /usr/lib/libQtGui.so.4
#35 0x00007f1c4e92ac5c in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#36 0x00007f1c4e9570e2 in ?? () from /usr/lib/libQtGui.so.4
#37 0x00007f1c48219342 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#38 0x00007f1c4821d2a8 in ?? () from /lib/libglib-2.0.so.0
#39 0x00007f1c4821d45c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#40 0x00007f1c4df1a193 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#41 0x00007f1c4e956a4e in ?? () from /usr/lib/libQtGui.so.4
#42 0x00007f1c4deeca02 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#43 0x00007f1c4deecdec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#44 0x00007f1c4def0ebb in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#45 0x0000000000452d58 in main (argc=<value optimized out>, argv=<value optimized out>) at /build/buildd/kmymoney-4.5/kmymoney/main.cpp:260

Maybe it could be bug in Skrooge export, however KMyMoney shouldn't just crash anyway.
Comment 3 Thomas Baumgart 2010-11-14 10:51:14 UTC
The cause of this problem in fact is the false generation of the KMyMoney file by Skrooge. The ACCOUNT entries are malformed. They show

  <ACCOUNT currency="Kč" description="" number="" parentaccount="" opened="" type="9" lastmodified="" id="AStd::Asset" lastreconciled="" name="Asset" institution="">

whereas they need to show

  <ACCOUNT currency="CZK" description="" number="" parentaccount="" opened="" type="9" lastmodified="" id="AStd::Asset" lastreconciled="" name="Asset" institution="">

Hint for the skrooge devs: Use the currency's ID rather than the symbol to craft the account entries. The resp. currency entry shows:

  <CURRENCY saf="100" symbol="Kč" type="3" id="CZK" name="Česká koruna (CZK)" ppu="100" scf="100"/>


I move this entry over to Skrooge. Once fixed, please send it back to KMyMoney4 so that we can work on eliminating the crash in case of a broken file.
Comment 4 Stephane MANKOWSKI 2010-11-14 17:13:34 UTC
This problem is already corrected with current SVN version of Skrooge
Comment 5 Cristian Oneț 2010-11-15 12:07:08 UTC
If this was corrected in Skrooge do we need something else to do on our side? Maybe when openning any kmymoney file we should handle the thrown KMyMoneyException with an invalid file message? If there's nothing else to do then please closed this bug.
Comment 6 Vit Pelcak 2010-11-15 12:43:02 UTC
Yes, please. Add some notification about corrupted file.

No program should crush like that, IMHO.

Thank you.
Comment 7 Thomas Baumgart 2010-12-15 10:23:04 UTC
SVN commit 1206653 by tbaumgart:

Improve handling if a file is loaded with an invalid base currency assignment

BUG: 253099

 M  +16 -2     dialogs/kcurrencyeditdlg.cpp  
 M  +56 -10    views/kmymoneyview.cpp  


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