Bug 301104

Summary: Crash Kmymoney after connection to mysql
Product: [Applications] kmymoney Reporter: Josef Leo Bureš <leo>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: crash CC: fvilas, onet.cristian, ppslim+kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In:

Description Josef Leo Bureš 2012-06-03 12:24:25 UTC
Application: kmymoney (3.98.1)
KDE Platform Version: 4.4.5 (KDE 4.4.5)
Qt Version: 4.6.3
Operating System: Linux 2.6.32-5-amd64 x86_64
Distribution: Debian GNU/Linux 6.0.5 (squeeze)

-- Information about the crash:
Error in function int MyMoneyStorageSql::upgradeDb() : Error retrieving file info(version)
Driver = QMYSQL, Host = localhost, User = leo, Database = KMyMoney
Driver Error: 
Database Error No -1: 
Text:  
Error type 0
Executed: SELECT version FROM kmmFileInfo;
Query error No -1:  
Error type 0

 -- Backtrace:
Application: KMyMoney (kmymoney), signal: Segmentation fault
[KCrash Handler]
#5  0x00000000008955ca in MyMoneyStorageSql::writeFileInfo (this=0x3386ed0) at /tmp/buildd/kmymoney-3.98.1/kmymoney/mymoney/storage/mymoneystoragesql.cpp:2417
#6  0x0000000000897b0d in MyMoneyStorageSql::close (this=0x3386ed0, logoff=true) at /tmp/buildd/kmymoney-3.98.1/kmymoney/mymoney/storage/mymoneystoragesql.cpp:226
#7  0x00000000008b412d in MyMoneyStorageSql::~MyMoneyStorageSql() ()
#8  0x00000000004cdae5 in ~KSharedPtr (this=0x29ee280, url=<value optimized out>) at /usr/include/ksharedptr.h:90
#9  KMyMoneyView::openDatabase (this=0x29ee280, url=<value optimized out>) at /tmp/buildd/kmymoney-3.98.1/kmymoney/views/kmymoneyview.cpp:891
#10 0x00000000004ce488 in KMyMoneyView::readFile (this=0x29ee280, url=...) at /tmp/buildd/kmymoney-3.98.1/kmymoney/views/kmymoneyview.cpp:611
#11 0x000000000049daf9 in KMyMoneyApp::slotFileOpenRecent (this=<value optimized out>, url=<value optimized out>) at /tmp/buildd/kmymoney-3.98.1/kmymoney/kmymoney.cpp:1469
#12 0x000000000049e7aa in KMyMoneyApp::slotOpenDatabase (this=0x273b560) at /tmp/buildd/kmymoney-3.98.1/kmymoney/kmymoney.cpp:1389
#13 0x00000000004a37ff in KMyMoneyApp::qt_metacall (this=0x273b560, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff134c41d0)
    at /tmp/buildd/kmymoney-3.98.1/obj-x86_64-linux-gnu/kmymoney/kmymoney.moc:499
#14 0x00007f7528db52e6 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#15 0x00007f752813c132 in QAction::triggered(bool) () from /usr/lib/libQtGui.so.4
#16 0x00007f752813e1ab in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQtGui.so.4
#17 0x00007f752857d751 in ?? () from /usr/lib/libQtGui.so.4
#18 0x00007f75285832e2 in ?? () from /usr/lib/libQtGui.so.4
#19 0x00007f752b51e81e in KMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libkdeui.so.5
#20 0x00007f7528198632 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#21 0x00007f75285854db in QMenu::event(QEvent*) () from /usr/lib/libQtGui.so.4
#22 0x00007f752814232c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#23 0x00007f7528148fdb in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#24 0x00007f752b442796 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#25 0x00007f7528da209c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#26 0x00007f75281481be in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#27 0x00007f75281c84fd in ?? () from /usr/lib/libQtGui.so.4
#28 0x00007f75281c69dc in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#29 0x00007f75281f25a2 in ?? () from /usr/lib/libQtGui.so.4
#30 0x00007f75224136f2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#31 0x00007f7522417568 in ?? () from /lib/libglib-2.0.so.0
#32 0x00007f752241771c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#33 0x00007f7528dcb6b3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#34 0x00007f75281f219e in ?? () from /usr/lib/libQtGui.so.4
#35 0x00007f7528da09c2 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#36 0x00007f7528da0d9c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#37 0x00007f7528da5a2b in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#38 0x000000000045ca58 in main (argc=<value optimized out>, argv=<value optimized out>) at /tmp/buildd/kmymoney-3.98.1/kmymoney/main.cpp:277

Possible duplicates by query: bug 283895, bug 263983, bug 252481, bug 250743, bug 249762.

Reported using DrKonqi
Comment 1 Fernando Vilas 2012-06-03 12:59:01 UTC
This looks a lot like bug 263983, which was fixed in source on 2012-04-27. I am not familiar enough with Debian Squeeze to tell when it pulled the source from git, though. Can someone who is provide some guidance here?
Comment 2 Fernando Vilas 2012-06-03 13:00:51 UTC
Oops... I need to read dates more carefully. The fix was in 2011, so the fix is almost certainly included. Something else must be going on.
Comment 3 Fernando Vilas 2012-06-03 13:14:54 UTC
It looks like the database exists, or it would not have gotten this far in the code. The main reasons for a failure of -1 with no details are flaky connections (there is a recent fix for that one), an empty database because of never doing a "save as database", and access issues to the data in the database.

@Josef: can you provide a little more detail, so we can rule out some or all of the above suggestions?
Comment 4 Cristian Oneț 2013-09-12 08:14:16 UTC
Could you please provide the details requested by Fernando?
Comment 5 Phil R 2013-12-31 00:59:45 UTC
I experienced this and a lot more on Windows.

The SQL used to populate this table does not seem to be correct.

Query as taken from the Generate Database SQL screen.

INSERT INTO kmmFileInfo (version, created, lastModified, baseCurrency, institutions, accounts, payees, transactions, splits, securities, prices, currencies, schedules, reports, kvps, dateRangeStart, dateRangeEnd, hiInstitutionId, hiPayeeId, hiAccountId, hiTransactionId, hiScheduleId, hiSecurityId, hiReportId, encryptData, updateInProgress, budgets, hiBudgetId, logonUser, logonAt, fixLevel) VALUES (6, 2013-12-31, 2013-12-31, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'N', NULL, NULL, NULL, NULL, 4)

Exact error when run manually from MySQL Workbench:
1 row(s) affected, 2 warning(s): 1265 Data truncated for column 'created' at row 1 1265 Data truncated for column 'lastModified' at row 1

Wrapping the dates for these columns in quotes fixed this. This also allowed me to get past this error whilst trying to open the database.
Comment 6 Fernando Vilas 2013-12-31 22:37:08 UTC
Git commit dcf351abba5323e07f222677206e23cd645af118 by Fernando Vilas.
Committed on 31/12/2013 at 22:34.
Pushed by fvilas into branch 'master'.

Delimit date strings in initial DB creation SQL. Everywhere else uses bind variables, so this should fix it.

M  +6    -2    kmymoney/mymoney/storage/mymoneydbdef.cpp

http://commits.kde.org/kmymoney/dcf351abba5323e07f222677206e23cd645af118