So this is how things _seem_ to go for this Bug:
"""
(gdb) bt
#0 0xa62c5649 in dbi_shutdown_r () from /usr/lib/i386-linux-gnu/libdbi.so.1
#1 0xa62c56dd in dbi_shutdown () from /usr/lib/i386-linux-gnu/libdbi.so.1
#2 0xa62da2f4 in gnc_module_finalize_backend_dbi () from
/usr/lib/i386-linux-gnu/gnucash/gnucash/libgncmod-backend-dbi.so
#3 0xa62da314 in qof_backend_module_finalize () from
/usr/lib/i386-linux-gnu/gnucash/gnucash/libgncmod-backend-dbi.so
#4 0xb7c9fb79 in qof_finalize_backend_libraries () from
/usr/lib/i386-linux-gnu/gnucash/libgnc-qof.so.1
"""
- In frame #4 some Gnucash library function is called without any arguments:
"""
253 void
254 qof_finalize_backend_libraries(void)
255 {
256 GSList* node;
257 GModule* backend;
258 void (*module_finalize_func) (void);
259
260 for (node = backend_module_list; node != NULL; node = node->next)
261 {
262 backend = (GModule*)node->data;
263
264 if (g_module_symbol(backend, "qof_backend_module_finalize",
265 (gpointer)&module_finalize_func))
266 module_finalize_func();
267
268 }
269 }
"""
- This seems to call a formerly registered function by the name of
"qof_backend_module_finalize", if it exists, which it must because it is found
in the conditional, for each and one of the backends (dbi being one, don't know
if there are others though):
"""
1939 qof_backend_module_finalize( void )
1940 {
1941 gnc_module_finalize_backend_dbi();
1942 }
1943 #endif /* GNC_NO_LOADABLE_MODULES */
1944
1945 void
1946 gnc_module_finalize_backend_dbi( void )
1947 {
1948 dbi_shutdown();
1949 }
"""
- That lead us to frames #3 and #2 without anything very interesting to say
about it. Let's dig deeper and closer to the real deal:
"""
274 void dbi_shutdown() {
275 dbi_shutdown_r(dbi_inst_legacy);
276 }
"""
- So we are calling some function which description in the library
documentation is as follows:
"""
Frees all loaded drivers and terminates the libdbi instance. You should close
each connection you opened before shutting down, but libdbi will clean up after
you if you don't.
Arguments
Inst: The instance handle
"""
- Then control passes on to frame #0, and then die after a SIGSEGV:
"""
243 void dbi_shutdown_r(dbi_inst Inst) {
244 dbi_inst_t *inst = (dbi_inst_t*) Inst;
245 dbi_conn_t *curconn = inst->rootconn;
246 dbi_conn_t *nextconn;
247
248 dbi_driver_t *curdriver = inst->rootdriver;
249 dbi_driver_t *nextdriver;
250
251 while (curconn) {
252 nextconn = curconn->next;
253 dbi_conn_close((dbi_conn)curconn);
254 curconn = nextconn;
255 }
256
257 while (curdriver) {
258 nextdriver = curdriver->next;
259 curdriver->functions->finalize(curdriver);
260 _safe_dlclose(curdriver);
261 free(curdriver->functions);
262 _free_custom_functions(curdriver);
263 _free_caps(curdriver->caps);
264 free(curdriver->filename);
265 free(curdriver);
266 curdriver = nextdriver;
267 }
268 #if HAVE_LTDL_H
269 (void)lt_dlexit();
270 #endif
271 free(inst);
272 }
"""
- As I haven't compiled gnucash from scratch with debug information, I
can only theorize, but considering libdbi must be some quite frequently
used piece of code, I can't see how the library code can be broken
- I rather believe gnucash is blindly calling the dbi_shutdown without
making sure there is really any dbi connection to shut down in the first
place. Therefore the "dbi_inst_legacy" may be NULL or garbage, and as
soon as it tries to be dereferenced (see line 244 above), the code
crashes.
- So probably the problem is with gnucash logic, which tries to shut
down a dbi connection because it has registered the driver during
initialization, but without really checking on shut down if there was a
connection open (or still open)
- In the end, the fix may be as easy as adding some check to
"gnc_module_finalize_backend_dbi" to see if there is really any
connection to shut down, to only call " dbi_shutdown" when really
necessary. Being a global, checking for "dbi_inst_legacy" being NULL is
probably enough, lacking any better way of checking for any outstanding
DBI connection
All in all, a 15 minute investigation for me and a 5 minute fix for any
gnucash package or upstream maintainer.
Hope this gets looked into ASAP to have a working application without it
crashing every time on shut down.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1369273
Title:
gnucash crashed with ImportError in /usr/share/gnucash/python/init.py:
No module named gnucash
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1369273/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs