Bug 22629

Summary: Gabble crashes when I close Rhythmbox with my tp tube plugin
Product: Telepathy Reporter: Alban Crequy <alban.crequy>
Component: gabbleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Alban Crequy 2009-07-06 04:11:11 UTC
Version: telepathy-gabble 0.7.30-1

Reproductible 50% of the time with my test case.

Test case: I close my application (a Rhythmbox plugin) while the tube is still open. The unix socket between the the Rhythmbox plugin and telepathy-gabble is close, and telepathy-gabble receives some data in the tube from the remote contact. The same application is handling both side of the tube (initiator and recipient).

ERROR:gibber-transport.c:226:gibber_transport_send: assertion failed: (transport->state == GIBBER_TRANSPORT_CONNECTED)

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fc76aaa17b0 (LWP 13281)]
0x00007fc7683e3d05 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007fc7683e3d05 in raise () from /lib/libc.so.6
#1  0x00007fc7683e6dc1 in abort () from /lib/libc.so.6
#2  0x00007fc768b810d0 in IA__g_assertion_message (domain=0x7fc768bbe6be "", 
    file=0x496905 "gibber-transport.c", line=<value optimized out>, func=0x496a90 "gibber_transport_send", 
    message=<value optimized out>) at /tmp/buildd/glib2.0-2.20.4/glib/gtestutils.c:1301
#3  0x00007fc768b81652 in IA__g_assertion_message_expr (domain=0x0, file=0x496905 "gibber-transport.c", 
    line=226, func=0x496a90 "gibber_transport_send", expr=<value optimized out>)
    at /tmp/buildd/glib2.0-2.20.4/glib/gtestutils.c:1312
#4  0x000000000045103e in gibber_transport_send (transport=<value optimized out>, data=<value optimized out>, 
    size=<value optimized out>, error=<value optimized out>) at gibber-transport.c:226
#5  0x000000000044a911 in data_received_cb (bytestream=0x1d55810, sender=<value optimized out>, 
    data=0x1cffe40, user_data=<value optimized out>) at tube-stream.c:1779
#6  0x00007fc768ff50ad in IA__g_closure_invoke (closure=0x1d652c0, return_value=0x0, n_param_values=3, 
    param_values=0x1d4e140, invocation_hint=0x7fff91a67450)
    at /tmp/buildd/glib2.0-2.20.4/gobject/gclosure.c:767
#7  0x00007fc76900885b in signal_emit_unlocked_R (node=0x1d4ef00, detail=0, instance=0x1d55810, 
    emission_return=0x0, instance_and_params=0x1d4e140) at /tmp/buildd/glib2.0-2.20.4/gobject/gsignal.c:3247
#8  0x00007fc769009c02 in IA__g_signal_emit_valist (instance=0x1d55810, signal_id=<value optimized out>, 
    detail=0, var_args=0x7fff91a67660) at /tmp/buildd/glib2.0-2.20.4/gobject/gsignal.c:2980
#9  0x00007fc769009f3a in IA__g_signal_emit_by_name (instance=0x1d55810, 
    detailed_signal=0x4933e6 "data-received") at /tmp/buildd/glib2.0-2.20.4/gobject/gsignal.c:3074
#10 0x00007fc768ff50ad in IA__g_closure_invoke (closure=0x1a22390, return_value=0x0, n_param_values=3, 
    param_values=0x1d39370, invocation_hint=0x7fff91a678b0)
    at /tmp/buildd/glib2.0-2.20.4/gobject/gclosure.c:767
#11 0x00007fc76900885b in signal_emit_unlocked_R (node=0x1d4ef00, detail=0, instance=0x1d1f3f0, 
    emission_return=0x0, instance_and_params=0x1d39370) at /tmp/buildd/glib2.0-2.20.4/gobject/gsignal.c:3247
#12 0x00007fc769009c02 in IA__g_signal_emit_valist (instance=0x1d1f3f0, signal_id=<value optimized out>, 
    detail=0, var_args=0x7fff91a67ac0) at /tmp/buildd/glib2.0-2.20.4/gobject/gsignal.c:2980
#13 0x00007fc769009f3a in IA__g_signal_emit_by_name (instance=0x1d1f3f0, 
    detailed_signal=0x4933e6 "data-received") at /tmp/buildd/glib2.0-2.20.4/gobject/gsignal.c:3074
#14 0x000000000045de7b in transport_handler (transport=<value optimized out>, data=<value optimized out>, 
    user_data=<value optimized out>) at bytestream-socks5.c:1146
#15 0x0000000000451175 in gibber_transport_received_data (transport=0x33e1, data=<value optimized out>, 
    length=6) at gibber-transport.c:163
#16 0x00000000004834ac in gibber_fd_transport_read (transport=0x1d13840, channel=<value optimized out>, 
    error=<value optimized out>) at gibber-fd-transport.c:403
#17 0x00000000004838aa in _channel_io_in (source=<value optimized out>, condition=<value optimized out>, 
    data=0x1d13840) at gibber-fd-transport.c:282
#18 0x00007fc768b5b7aa in IA__g_main_context_dispatch (context=0x16bfde0)
    at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:1824
#19 0x00007fc768b5edf8 in g_main_context_iterate (context=0x16bfde0, block=1, dispatch=1, 
    self=<value optimized out>) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:2455
#20 0x00007fc768b5f2cd in IA__g_main_loop_run (loop=0x16bfec0) at /tmp/buildd/glib2.0-2.20.4/glib/gmain.c:2663
#21 0x00007fc769797f28 in tp_run_connection_manager () from /usr/lib/libtelepathy-glib.so.0
#22 0x00007fc7683d05a6 in __libc_start_main () from /lib/libc.so.6
#23 0x0000000000412ff9 in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb) f 4
#4  0x000000000045103e in gibber_transport_send (transport=<value optimized out>, data=<value optimized out>, 
    size=<value optimized out>, error=<value optimized out>) at gibber-transport.c:226
226	gibber-transport.c: No such file or directory.
	in gibber-transport.c
(gdb) p transport->state
Cannot access memory at address 0x18
(gdb) p transport
$1 = <value optimized out>
(gdb) 


The last debug messages are:


(telepathy-gabble:13797): gabble-DEBUG: socks5_connect: Trying streamhost 192.168.73.192 on port 34353
(telepathy-gabble:13797): gabble-DEBUG: new_connection_cb: New connection...
(telepathy-gabble:13797): gabble-DEBUG: transport_connected_cb: transport is connected. Sending auth request
(telepathy-gabble:13797): gabble-DEBUG: transport_handler: got 3 bytes from sock5 transport
(telepathy-gabble:13797): gabble-DEBUG: socks5_handle_received_data: Received auth request. Sending auth reply
(telepathy-gabble:13797): gabble-DEBUG: transport_handler: got 2 bytes from sock5 transport
(telepathy-gabble:13797): gabble-DEBUG: socks5_handle_received_data: Received auth reply. Sending CONNECT command
(telepathy-gabble:13797): gabble-DEBUG: transport_handler: got 47 bytes from sock5 transport
(telepathy-gabble:13797): gabble-DEBUG: socks5_handle_received_data: Received CONNECT cmd. Sending CONNECT reply
(telepathy-gabble:13797): gabble-DEBUG: socks5_handle_received_data: sock5 stream connected. Stop to listen for connections
(telepathy-gabble:13797): gabble-DEBUG: transport_handler: got 47 bytes from sock5 transport
(telepathy-gabble:13797): gabble-DEBUG: target_got_connect_reply: Received CONNECT reply. Socks5 stream connected. Bytestream is now open
(telepathy-gabble:13797): gabble-DEBUG: extra_bytestream_state_changed_cb: Called.
(telepathy-gabble:13797): gabble-DEBUG: extra_bytestream_state_changed_cb: extra bytestream open
(telepathy-gabble:13797): gabble-DEBUG: socks5_init_reply_cb: Target is connected to us
(telepathy-gabble:13797): gabble-DEBUG: socks5_init_reply_cb: Socks5 stream initiated using stream: bernard_test@localhost/Telepathy.f5dc1c10
(telepathy-gabble:13797): gabble-DEBUG: extra_bytestream_state_changed_cb: Called.
(telepathy-gabble:13797): gabble-DEBUG: extra_bytestream_state_changed_cb: extra bytestream open
(telepathy-gabble:13797): gabble-DEBUG: transport_handler: read 239 bytes from socket
(telepathy-gabble:13797): gabble-DEBUG: gabble_bytestream_socks5_send: send 239 bytes through bytestream
(telepathy-gabble:13797): gabble-DEBUG: transport_handler: got 239 bytes from sock5 transport
(telepathy-gabble:13797): gabble-DEBUG: data_received_cb: received 239 bytes from bytestream
**
ERROR:gibber-transport.c:226:gibber_transport_send: assertion failed: (transport->state == GIBBER_TRANSPORT_CONNECTED)

Program received signal SIGABRT, Aborted.
Comment 1 Alban Crequy 2009-07-09 11:03:22 UTC
== Recipient side ==
Application --(GibberTransport)--> CM --(Bytestream)--> internet...

When the local application connects to the CM, the GibberTransport is blocked with gibber_transport_block_receiving() while the Bytestream is not open. So we don't need to receive and bufferize data while the Bytestream is connecting.

== Initiator side ==
...internet --(Bytestream)--> CM --(GibberTransport)--> Application

But when a new bytestream incomes, the bytestream is not blocked. My branch do it:

http://git.collabora.co.uk/?p=user/alban/telepathy-gabble.git;a=shortlog;h=refs/heads/tube-test

This bug does not have a unit test written for it.
Comment 2 Guillaume Desmottes 2009-07-13 03:16:10 UTC
+  g_assert (transport->state == GIBBER_TRANSPORT_CONNECTED);
You should probably use gibber_transport_get_state (transport)
Comment 3 Alban Crequy 2009-07-17 04:08:58 UTC
(In reply to comment #2)
> +  g_assert (transport->state == GIBBER_TRANSPORT_CONNECTED);
> You should probably use gibber_transport_get_state (transport)
> 

branch updated.
Comment 4 Guillaume Desmottes 2009-07-17 05:48:40 UTC
+1
Comment 5 Guillaume Desmottes 2009-07-17 06:17:50 UTC
oh yeah, could add an entry to the NEWS file please?
Comment 6 Alban Crequy 2009-07-17 06:32:05 UTC
branch merged upstream in master:
bc107111c8ae38ece8da9c6c27b7c7aa9cdacdf9
including the change to the NEWS file.

It should be in the next release 0.7.31.

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.