GNOME Bugzilla – Bug 630770
Crash when connection lost using db
Last modified: 2018-06-29 22:45:17 UTC
When using a mysql database connection and loading successfully but during working the connection is lost, upon entering the next transaction into an account gnucash will crash. This was actually using a secure tunnel where the secure tunnel had dropped temporarily. Ideally it should detect a broken connection and throw an error and retry dialog.
Confirmed. When a connection is lost, GnuCash tries to restore it before continuing. It tries this 5 times in a row. But from there on the backend code assumes the connection exists. See for example conn_begin_transaction: no matter what the result of the dbi call early in the function, it will return TRUE, meaning success. This function and its related functions could be made to return FALSE upon errors, but the results are ignored further down the stack also. So to fix this, the functions calling conn_* should also be changed to test the return values and act properly on them. That may be sufficient to prevent a crash and perhaps even show an error message to the user. The code is fairly complex though, so I may have missed some conditions. Adding a retry dialog will require more code work. The current design doesn't support user action as a result of backend errors.
This problem has been fixed in the development version, r19728. The fix will be available in the next major software release. I have improved the detection mechanism for lost db connections. It works both for mysql and postgresql now. It will attempt to restore the connection as before. If that fails it will now display an error instead of crashing. Note that the error messages is pretty undescriptive currently. Bug 632558 is targeting that flaw. The error reporting will be better when that bug is fixed. Thank you for your bug report.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=630770. Please update any external references or bookmarks.