I believe I may have found a bug in the current 4.6.4 release in regards to SQL database feature. I am currently using a .kmy file and tried to migrate to a remote MySQL database. The application is crashing severely when I hit the OK button of the database creation window. I get an error popup saying: Cannot open database sql://remoteuser@serverip/kmymoney?driver=QMYSQL&secure=yes Details: Error in function int MyMoneyStorageSql::upgradeDb() : Error retrieving file info(version) Driver = QMYSQL, Host = serverip, User = remoteuser, Database = kmymoney Driver Error: Database Error No -1: Text: Error type 0 Executed: SELECT version FROM kmmFileInfo; Query error No -1: Error type 0 Then I click OK and it crashes. Reproducible: Always Steps to Reproduce: 1- Close current kmy file 2-File -> Open database 3-Database type: QMYSQL - MYSQL 4-DB name: kmymoney (identical to the DB on the remote server) 5-hostname: IP of the remote server 6-username: username that has full rights on dtaabase kmymoney on the remote SQL server 7-password: password of the user above 8-Click OK Actual Results: KMM crashes, see above for actual results and "Additional info" for backtrace. Expected Results: Connect to the remote MySQL server Backtrace: Application: KMyMoney (kmymoney), signal: Segmentation fault [Current thread is 1 (Thread 0x7f2150ba2780 (LWP 15838))] Thread 2 (Thread 0x7f214268e700 (LWP 15839)): #0 0x00007f214b3968b3 in poll () from /lib64/libc.so.6 #1 0x00007f214540ce34 in ?? () from /usr/lib64/libglib-2.0.so.0 #2 0x00007f214540d742 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0 #3 0x00007f2142bb7e64 in ?? () from /usr/lib64/libgio-2.0.so.0 #4 0x00007f2145434126 in ?? () from /usr/lib64/libglib-2.0.so.0 #5 0x00007f214dfe3d6b in start_thread () from /lib64/libpthread.so.0 #6 0x00007f214b3a0abd in clone () from /lib64/libc.so.6 Thread 1 (Thread 0x7f2150ba2780 (LWP 15838)): [KCrash Handler] #6 0x0000000000809d6a in MyMoneyStorageSql::writeFileInfo (this=0x1357b50) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/mymoney/storage/mymoneystoragesql.cpp:2356 #7 0x000000000080b8c7 in MyMoneyStorageSql::close (this=0x1357b50, logoff=<value optimized out>) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/mymoney/storage/mymoneystoragesql.cpp:229 #8 0x000000000083da91 in ~MyMoneyStorageSql (this=<value optimized out>, __in_chrg=<value optimized out>) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/mymoney/storage/mymoneystoragesql.h:141 #9 MyMoneyStorageSql::~MyMoneyStorageSql (this=<value optimized out>, __in_chrg=<value optimized out>) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/mymoney/storage/mymoneystoragesql.h:142 #10 0x00000000004c798d in ~KSharedPtr (this=0xe26840, url=<value optimized out>) at /usr/include/ksharedptr.h:90 #11 KMyMoneyView::openDatabase (this=0xe26840, url=<value optimized out>) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/views/kmymoneyview.cpp:884 #12 0x00000000004c81df in KMyMoneyView::readFile (this=0xe26840, url=<value optimized out>) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/views/kmymoneyview.cpp:643 #13 0x0000000000497b0e in KMyMoneyApp::slotFileOpenRecent (this=0xc8a690, url=...) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/kmymoney.cpp:1529 #14 0x000000000049851f in KMyMoneyApp::slotOpenDatabase (this=0xc8a690) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/kmymoney.cpp:1444 #15 0x00000000004a1dff in KMyMoneyApp::qt_metacall (this=0xc8a690, _c=QMetaObject::InvokeMetaMethod, _id=112, _a=0x7fffbe2f8d40) at /home/louis-philippe/kmymoney-4.6.4/build/kmymoney/kmymoney.moc:515 #16 0x00007f214cecf60f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/qt/lib/libQtCore.so.4 #17 0x00007f214bfe9092 in QAction::triggered(bool) () from /usr/lib64/qt/lib/libQtGui.so.4 #18 0x00007f214bfe928a in QAction::activate(QAction::ActionEvent) () from /usr/lib64/qt/lib/libQtGui.so.4 #19 0x00007f214c41f423 in ?? () from /usr/lib64/qt/lib/libQtGui.so.4 #20 0x00007f214c4253ba in ?? () from /usr/lib64/qt/lib/libQtGui.so.4 #21 0x00007f214f2bb76d in KMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libkdeui.so.5 #22 0x00007f214c040df8 in QWidget::event(QEvent*) () from /usr/lib64/qt/lib/libQtGui.so.4 #23 0x00007f214c4265ab in QMenu::event(QEvent*) () from /usr/lib64/qt/lib/libQtGui.so.4 #24 0x00007f214bfef724 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/qt/lib/libQtGui.so.4 #25 0x00007f214bff4a3c in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/qt/lib/libQtGui.so.4 #26 0x00007f214f1eabf6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5 #27 0x00007f214ceba1ac in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/qt/lib/libQtCore.so.4 #28 0x00007f214bff0735 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/qt/lib/libQtGui.so.4 #29 0x00007f214c06e18c in ?? () from /usr/lib64/qt/lib/libQtGui.so.4 #30 0x00007f214c06c649 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/qt/lib/libQtGui.so.4 #31 0x00007f214c093af2 in ?? () from /usr/lib64/qt/lib/libQtGui.so.4 #32 0x00007f214540c8f3 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 #33 0x00007f214540d0d0 in ?? () from /usr/lib64/libglib-2.0.so.0 #34 0x00007f214540d36d in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0 #35 0x00007f214cee51ff in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt/lib/libQtCore.so.4 #36 0x00007f214c09379e in ?? () from /usr/lib64/qt/lib/libQtGui.so.4 #37 0x00007f214ceb9562 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt/lib/libQtCore.so.4 #38 0x00007f214ceb97ac in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt/lib/libQtCore.so.4 #39 0x00007f214cebdc4b in QCoreApplication::exec() () from /usr/lib64/qt/lib/libQtCore.so.4 #40 0x000000000045948a in runKMyMoney (splash=<value optimized out>, a=<value optimized out>) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/main.cpp:282 #41 0x000000000045b353 in main (argc=1, argv=0x7fffbe2fb298) at /home/louis-philippe/kmymoney-4.6.4/kmymoney/main.cpp:181
It probably needs to be clarified in the documentation... In the interest of supporting multiple database backends, KMM is unable to actually create the database through the connection. Can you try creating a database called "kmymoney" on your MySQL server? From there, then repeat the steps and it should succeed. If this is the case, we can update the docs and UI strings quickly. If something else is still the problem, then we can work on fixing that.
Hello Fernando, I had already created the database lolcalyy on the Mysql server with the following statements: CREATE DATABASE kmymoney; GRANT ALL ON kmymoney.* TO lp.allard.1@remoteIP; FLUSH PRIVILEGES; I have confirmed with phpmyadmin that I (as user) have full access to the kmymoney database remotely from the machine I intend to use.. Funny thing, when I try to connect to the remote DB, the MySQL server throws the following line in the server's logs: 131113 7:17:08 [Warning] Aborted connection 643 to db: 'kmymoney' user: 'lp,allard.1' host: 'remoteIP' (Got an error reading communication packets) I believe the "error reading communication packets" is due to KMM crashing thus abruptly closing the connection to the SQL server..
Actually the syntax I used on the SQL server was: CREATE DATABASE kmymoney; CREATE USER 'lp.allard.1'@'remoteIP' IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON kmymoney.* TO 'lp.allard.1'@'remoteIP' FLUSH PRIVILEGES;
Forgot to add, I just looked in phpmyadmin to confirm once again the privileges and user settings were right, and I was surprised to see that the database kmymoney is populated with tables such as: kmmAccounts kmmBudgetConfig kmmCurrencies kmmFileInfo kmmInstitutions kmmKeyValuePairs kmmPayees kmmPrices kmmReportConfig kmmSchedulePaymentHistory kmmSchedules kmmSecurities kmmSplits kmmTransactions So I believe something is working but not everything..
Hmm... I think there is a way to keep it from crashing if someone else hits this. In the meantime, can you try something else? You list a series of steps to reproduce the error. Instead of closing the .kmy file, can you try a "Save as database"? That should populate the database so that it can proceed in the future.
I have saved the file as database, KM populated the DB on the remote SQL server and from now on it uses the DB instead of the kmy file on the local machine. As far as I know, its now working fine. In between, I have restarted the MySQL server and this seemed to help. I am not ruling out an issue on the server's end or a network error due to the "error reading communication packets".. I will monitor if this is stable and if so I will propose to close this report unless you want me to do more testing? In the end, KMM shouldnt just "quit" with a seg fault if something is not set properly...
Agreed... I will work on fixing this crash over the weekend. The user needs more information about what is going on and how to fix it instead of a crash.
Other than that, I have been extensively pounding on the SQL connection with KMM and so far its rock solid! Sometimes it needs a few seconds to display a page in KMM for ledgers with several thousands of transactions but its overall really fluid experience. Good job guys with the SQL connection!!
Git commit 88b8f16696f7ba5fb97f351e03877de573799491 by Fernando Vilas. Committed on 06/12/2013 at 04:29. Pushed by fvilas into branch 'master'. Fix crashes from uncaught exceptions opening files/databases. Related: bug 327718 M +15 -10 kmymoney/kmymoney.cpp M +24 -0 kmymoney/mymoney/storage/mymoneydatabasemgrtest.cpp M +1 -0 kmymoney/mymoney/storage/mymoneydatabasemgrtest.h http://commits.kde.org/kmymoney/88b8f16696f7ba5fb97f351e03877de573799491