After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 600800 - Crash when searching through logs
Crash when searching through logs
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Archives
2.29.x
Other Linux
: Normal blocker
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2009-11-05 10:32 UTC by Guillaume Desmottes
Modified: 2011-08-29 10:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/log-crash-600800 (460 bytes, patch)
2009-11-16 17:21 UTC, Guillaume Desmottes
none Details | Review

Description Guillaume Desmottes 2009-11-05 10:32:34 UTC
Probably a regression due to TpAccount.

GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `TpAccount'
aborting...

Program received signal SIGABRT, Aborted.
0x00007fffeec844b5 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	../nptl/sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
	in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) bt
  • #0 *__GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 *__GI_abort
    at abort.c line 92
  • #2 IA__g_logv
    at /build/buildd/glib2.0-2.22.2/glib/gmessages.c line 549
  • #3 IA__g_log
    at /build/buildd/glib2.0-2.22.2/glib/gmessages.c line 569
  • #4 IA__g_type_check_instance_cast
    at /build/buildd/glib2.0-2.22.2/gobject/gtype.c line 3740
  • #5 log_store_empathy_search_hit_new
    at empathy-log-store-empathy.c line 415
  • #6 log_store_empathy_search_new
    at empathy-log-store-empathy.c line 643
  • #7 empathy_log_manager_search_new
    at empathy-log-manager.c line 358
  • #8 log_window_find_populate
    at empathy-log-window.c line 428
  • #9 log_window_button_find_clicked_cb
    at empathy-log-window.c line 574
  • #10 IA__g_closure_invoke
    at /build/buildd/glib2.0-2.22.2/gobject/gclosure.c line 767
  • #11 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 3247
  • #12 IA__g_signal_emit_valist
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 2980
  • #13 IA__g_signal_emit
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 3037
  • #14 gtk_real_button_released
    at /build/buildd/gtk+2.0-2.18.3/gtk/gtkbutton.c line 1707
  • #15 IA__g_closure_invoke
    at /build/buildd/glib2.0-2.22.2/gobject/gclosure.c line 767
  • #16 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 3177
  • #17 IA__g_signal_emit_valist
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 2980
  • #18 IA__g_signal_emit
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 3037
  • #19 gtk_button_button_release
    at /build/buildd/gtk+2.0-2.18.3/gtk/gtkbutton.c line 1599
  • #20 _gtk_marshal_BOOLEAN__BOXED
    at /build/buildd/gtk+2.0-2.18.3/gtk/gtkmarshalers.c line 84
  • #21 IA__g_closure_invoke
    at /build/buildd/glib2.0-2.22.2/gobject/gclosure.c line 767
  • #22 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 3285
  • #23 IA__g_signal_emit_valist
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 2990
  • #24 IA__g_signal_emit
    at /build/buildd/glib2.0-2.22.2/gobject/gsignal.c line 3037
  • #25 gtk_widget_event_internal
    at /build/buildd/gtk+2.0-2.18.3/gtk/gtkwidget.c line 4767
  • #26 IA__gtk_propagate_event
    at /build/buildd/gtk+2.0-2.18.3/gtk/gtkmain.c line 2417
  • #27 IA__gtk_main_do_event
    at /build/buildd/gtk+2.0-2.18.3/gtk/gtkmain.c line 1622
  • #28 gdk_event_dispatch
    at /build/buildd/gtk+2.0-2.18.3/gdk/x11/gdkevents-x11.c line 2369
  • #29 g_main_dispatch
    at /build/buildd/glib2.0-2.22.2/glib/gmain.c line 1960
  • #30 IA__g_main_context_dispatch
    at /build/buildd/glib2.0-2.22.2/glib/gmain.c line 2513
  • #31 g_main_context_iterate
    at /build/buildd/glib2.0-2.22.2/glib/gmain.c line 2591
  • #32 IA__g_main_loop_run
    at /build/buildd/glib2.0-2.22.2/glib/gmain.c line 2799
  • #33 IA__gtk_main
    at /build/buildd/gtk+2.0-2.18.3/gtk/gtkmain.c line 1218
  • #34 main
    at empathy.c line 1038

Comment 1 Guillaume Desmottes 2009-11-05 15:11:28 UTC
Seems tp_account_manager_get_valid_accounts () returns a list containing something which is not a TpAccount.

Jonny: is that because the accounts manager is not prepared (cfr FIXME) ?
Comment 2 Guillaume Desmottes 2009-11-16 12:57:36 UTC
It seems to be a tp-glib bug. I opened https://bugs.freedesktop.org/show_bug.cgi?id=25117 so we can close this bug for now.
Comment 3 Simon McVittie 2009-11-16 13:43:31 UTC
I don't see tp_account_manager_get_valid_accounts () in the backtrace. Did you call it but then return to the main loop without reffing the returned accounts? If so, please reopen and fix in Empathy.

(The hash table does contain reffed accounts, so at first glance I don't see how the accounts could possibly be invalid during the call to tp_account_manager_get_valid_accounts(); however, the accounts could be removed from the hash table during a later entry to the main loop, which would invalidate the pointers you had borrowed.)
Comment 4 Guillaume Desmottes 2009-11-16 14:30:02 UTC
Code is:

  accounts = tp_account_manager_get_valid_accounts (priv->account_manager);

  for (l = accounts; l != NULL; l = g_list_next (l))
    {
      TpAccount *account = TP_ACCOUNT (l->data);


and the crash occurs in the TP_ACCOUNT cast.
Note that there is a FIXME saying that the account mgr MAY not be ready; but that shouldn't return a list containiving invalid pointers, right?
Comment 5 Simon McVittie 2009-11-16 15:26:57 UTC
... but what else do you do in the body of the loop? Anything that can cause an unref can cause a pointer in the list to become invalid.

One way to debug this would be to have a loop that asserts TP_IS_ACCOUNT and nothing else, immediately after the method call?

When the TpAM is not ready, it should indeed still not return invalid pointers; I don't see any evidence in the code that it would, though. It currently returns g_hash_table_get_values() from a hash table whose elements are reffed by the hash table, so they should all be valid regardless, unless something somewhere is doing an unbalanced unref?
Comment 6 Guillaume Desmottes 2009-11-16 17:17:45 UTC
Rahh got it. I assumed tp_account_manager_get_valid_accounts() returned a list of reffed accounts while it doesn't (I didn't write this code and naively assumed it was using this function the right way).

Sorry for wasting your time.
Comment 7 Guillaume Desmottes 2009-11-16 17:21:39 UTC
Created attachment 147916 [details] [review]
http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/log-crash-600800

 libempathy/empathy-log-store-empathy.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
Comment 8 Guillaume Desmottes 2009-11-16 17:22:26 UTC
I checked in all the place where this function is called and this one is the only one doing that stupid mistake.
Comment 9 Guillaume Desmottes 2009-11-16 17:32:47 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.