Bug 17154 - XmppConnection survives when the user goes offline, and Salut segfault
Summary: XmppConnection survives when the user goes offline, and Salut segfault
Status: RESOLVED WONTFIX
Alias: None
Product: Telepathy
Classification: Unclassified
Component: salut (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Sjoerd Simons
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-15 09:05 UTC by Alban Crequy
Modified: 2011-08-26 03:14 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Alban Crequy 2008-08-15 09:05:51 UTC
Because I was trying to avoid the Bug #17090, I followed this scenario:
- I use Empathy and Salut, and I chat with my contact who uses iChat
- Because of the Bug #17090, I cannot send any more messages, so I go offline and go online again in order to send a new message.
- I get this crash below.

The tcp connection to my contact is still alive in the new Salut Connection, and when my contact sends me the XEP-0174 closing stanza, Salut tries to access some freed objects.

We want to close the xmpp connection nicely when the user goes offline: stop listening on the socket first to avoid new stream with other contacts, and close all xmpp connections. Queued message may not be sent correctly during this process.



** (telepathy-salut:10976): DEBUG: gibber_fd_transport_read: Received 17 bytes
** (telepathy-salut:10976): DEBUG: gibber_xmpp_reader_push: Parsing chunk: </stream:stream>

** (telepathy-salut:10976): DEBUG: _end_element_ns: Element stream:stream ended, depth 0
** (telepathy-salut:10976): DEBUG: connection_stream_closed_cb: Received stream closed
** (telepathy-salut:10976): DEBUG: close_connection: connection with mycontact@ordinateur-de-mycontact fully closed. Remove it

GLib-GObject-CRITICAL **: g_type_instance_get_private: assertion `instance != NULL && instance->g_class != NULL' failed

#0  0x00007fa917e49ef5 in raise () from /lib/libc.so.6
#1  0x00007fa917e4b413 in abort () from /lib/libc.so.6
#2  0x00007fa9184614fb in IA__g_logv (
    log_domain=0x7fa91871245c "GLib-GObject", log_level=G_LOG_LEVEL_CRITICAL, 
    format=0x7fa918497237 "%s: assertion `%s' failed", args1=0x7fff216fe160)
    at /build/buildd/glib2.0-2.16.5/glib/gmessages.c:497
#3  0x00007fa918461583 in IA__g_log (
    log_domain=0x2ae0 <Address 0x2ae0 out of bounds>, log_level=10976, 
    format=0x6 <Address 0x6 out of bounds>)
    at /build/buildd/glib2.0-2.16.5/glib/gmessages.c:517
#4  0x00007fa9187068ba in IA__g_type_instance_get_private (instance=0x1d5b0a0, 
    private_type=30760944) at /build/buildd/glib2.0-2.16.5/gobject/gtype.c:3546
#5  0x00007fa91818b4d1 in tp_base_connection_get_handles (self=0x1d5b0a0, 
    handle_type=TP_HANDLE_TYPE_CONTACT) at base-connection.c:1427
#6  0x000000000041c90f in salut_contact_dispose (object=0x1d75ef0)
    at salut-contact.c:266
#7  0x00007fa9186eee22 in IA__g_object_unref (_object=<value optimized out>)
    at /build/buildd/glib2.0-2.16.5/gobject/gobject.c:1765
#8  0x00007fa918449b92 in g_hash_table_remove_node (hash_table=0x1d47e00, 
    node_ptr_ptr=0x2ae0, notify=6)
    at /build/buildd/glib2.0-2.16.5/glib/ghash.c:204
#9  0x00007fa91844aa05 in g_hash_table_remove_internal (hash_table=0x1d47e00, 
    key=0x1d6cd90, notify=1) at /build/buildd/glib2.0-2.16.5/glib/ghash.c:848
#10 0x0000000000410c67 in remove_connection (self=<value optimized out>, 
    connection=0x2ae0) at salut-xmpp-connection-manager.c:262
#11 0x0000000000411849 in close_connection (self=0x1d64800, 
    connection=0x1d6cd90) at salut-xmpp-connection-manager.c:318
#12 0x00007fa9186ecebd in IA__g_closure_invoke (closure=0x1d822a0, 
    return_value=0x0, n_param_values=1, param_values=0x7fff216fe620, 
    invocation_hint=0x7fff216fe520)
    at /build/buildd/glib2.0-2.16.5/gobject/gclosure.c:490
#13 0x00007fa9186ffc2d in signal_emit_unlocked_R (node=0x1d6bcf0, detail=0, 
    instance=0x1d6cd90, emission_return=0x0, 
    instance_and_params=0x7fff216fe620)
    at /build/buildd/glib2.0-2.16.5/gobject/gsignal.c:2440
#14 0x00007fa918701116 in IA__g_signal_emit_valist (instance=0x1d6cd90, 
    signal_id=<value optimized out>, detail=0, var_args=0x7fff216fe880)
    at /build/buildd/glib2.0-2.16.5/gobject/gsignal.c:2199
#15 0x00007fa918701623 in IA__g_signal_emit (instance=0x2ae0, signal_id=10976, 
    detail=6) at /build/buildd/glib2.0-2.16.5/gobject/gsignal.c:2243
#16 0x00007fa9186ecebd in IA__g_closure_invoke (closure=0x1d821d0, 
    return_value=0x0, n_param_values=1, param_values=0x7fff216feba0, 
    invocation_hint=0x7fff216feaa0)
    at /build/buildd/glib2.0-2.16.5/gobject/gclosure.c:490
#17 0x00007fa9186ffc2d in signal_emit_unlocked_R (node=0x1d7d650, detail=0, 
    instance=0x1d64e00, emission_return=0x0, 
    instance_and_params=0x7fff216feba0)
    at /build/buildd/glib2.0-2.16.5/gobject/gsignal.c:2440
#18 0x00007fa918701116 in IA__g_signal_emit_valist (instance=0x1d64e00, 
    signal_id=<value optimized out>, detail=0, var_args=0x7fff216fee00)
    at /build/buildd/glib2.0-2.16.5/gobject/gsignal.c:2199
#19 0x00007fa918701623 in IA__g_signal_emit (instance=0x2ae0, signal_id=10976, 
    detail=6) at /build/buildd/glib2.0-2.16.5/gobject/gsignal.c:2243
#20 0x0000000000438251 in gibber_xmpp_reader_push (reader=0x1d64e00, 
    data=0x7fff216fef60 "</stream:stream>\n", length=17, 
    error=<value optimized out>) at gibber-xmpp-reader.c:423
#21 0x000000000042fa9d in _xmpp_connection_received_data (
    transport=<value optimized out>, buffer=0x7fff216fef40, 
    user_data=<value optimized out>) at gibber-xmpp-connection.c:339
#22 0x0000000000439975 in gibber_transport_received_data (transport=0x2ae0, 
    data=<value optimized out>, length=6) at gibber-transport.c:163
#23 0x000000000044792c in gibber_fd_transport_read (transport=0x1d64b80, 
    channel=<value optimized out>, error=<value optimized out>)
    at gibber-fd-transport.c:362
#24 0x000000000044731a in _channel_io_in (source=<value optimized out>, 
    condition=<value optimized out>, data=0x1d64b80)
    at gibber-fd-transport.c:263
#25 0x00007fa918457892 in IA__g_main_context_dispatch (context=0x1d4d2c0)
    at /build/buildd/glib2.0-2.16.5/glib/gmain.c:2012
#26 0x00007fa91845b01d in g_main_context_iterate (context=0x1d4d2c0, block=1, 
    dispatch=1, self=<value optimized out>)
    at /build/buildd/glib2.0-2.16.5/glib/gmain.c:2645
#27 0x00007fa91845b54d in IA__g_main_loop_run (loop=0x1d499d0)
    at /build/buildd/glib2.0-2.16.5/glib/gmain.c:2853
#28 0x00007fa9181e6f43 in tp_run_connection_manager (
    prog_name=0x447d04 "telepathy-salut", version=0x447d30 "0.3.3.1", 
    construct_cm=0x40b090 <salut_create_connection_manager>, argc=1, 
    argv=0x7fff216ff648) at run.c:263
#29 0x00007fa917e361a6 in __libc_start_main () from /lib/libc.so.6
#30 0x000000000040af59 in _start ()
Comment 1 Alban Crequy 2008-09-18 07:58:27 UTC
This commit fixs the crash:
bacc24df0a662a31c9b62bf0da194ec16a8caaa2 in my "tubes" branch.

------------
commit bacc24df0a662a31c9b62bf0da194ec16a8caaa2
Author: Alban Crequy <alban.crequy@collabora.co.uk>
Date:   Thu Sep 18 15:35:56 2008 +0100

    SalutTubesManager: Do not reference objects twice in set_property

------------

When xmpp_connection_manager is released, all XmppConnection are disconnected. xmpp_connection_manager belongs to SalutConnection (it is unref in salut_connection_dispose). Channel managers (text channel manager and tube channel manager) keep a reference on it.

When disconnecting the SalutConnection, all channels are closed (by tp_base_connection_close_all_channels) and all channel managers are unreferenced (by tp_base_connection_dispose).

The bug was SalutTubesManager keeped 2 references on the xmpp_connection_manager, so the XmppConnection were not disconnected.



I keep the bug open because we should check this is done correctly as stated in the bug report: "stop listening on the socket first to avoid new stream with other contacts, and close all xmpp connections".
Comment 2 Alban Crequy 2008-09-19 04:31:16 UTC
Comment #1 was mostly bs. Commit bacc24df is bad.
Comment 3 Will Thompson 2011-08-26 03:14:41 UTC
XmppConnection is gone forever!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.