Bug 49163

Summary: Connection time out : msg_sending flag unset before behing set
Product: Telepathy Reporter: Alban Browaeys <prahal>
Component: idleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED NOTOURBUG QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: major    
Priority: medium    
Version: git master   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: use idle version of complete

Description Alban Browaeys 2012-04-26 00:49:10 UTC
Telepathy idle ends up with "Connection time out" all the time. It turns out that with glib/gio git master priv->msg_sending flag in idle-connection.c msg_queue_timeout_cb is set to FALSE in the _msg_queue_timeout_ready before behing set to TRUE. This leads to infinite msg_timed_out_cb calls (ie until the server send the connection timed out).

The backtrace of the tp idle shows that :
g_output_stream_write_real_async triggers _write_async_pollable and in this use case it ends up calling the non idle version g_simple_async_result_complete. All this happens before idle_server_connection_send_async with callback _msg_queue_timeout_ready completes. As this callback set back priv->msg_sending to FALSE, and the initialization of this variable to TRUE happens after the idle_server_connection_send_async call, priv->msg_sending stays at TRUE until connection is aborted by the server.

To avoid this the patch calls g_simple_async_result_complete_in_idle instead ofg_simple_async_result_complete_in_idle in  idle-server-connection.c function _write_ready.
Comment 1 Alban Browaeys 2012-04-26 05:54:37 UTC
Created attachment 60614 [details] [review]
use idle version of complete
Comment 2 Will Thompson 2012-10-30 17:36:01 UTC
Hi, sorry for the slow response to your bug report.

(In reply to comment #0)
> The backtrace of the tp idle shows that :
> g_output_stream_write_real_async triggers _write_async_pollable and in this
> use case it ends up calling the non idle version
> g_simple_async_result_complete.

Which GLib version are/were you using? I think this was a GLib bug, introduced by this commit <http://git.gnome.org/browse/glib/commit/?id=00ee06e> and fixed by this commit <http://git.gnome.org/browse/glib/commit/?id=fd3ec4d>. Notice that, with the latter patch, g_output_stream_real_write_async() correctly initializes op->need_idle to TRUE.
Comment 3 Will Thompson 2012-10-30 17:42:40 UTC
(In reply to comment #2)
> Hi, sorry for the slow response to your bug report.
> 
> (In reply to comment #0)
> > The backtrace of the tp idle shows that :
> > g_output_stream_write_real_async triggers _write_async_pollable and in this
> > use case it ends up calling the non idle version
> > g_simple_async_result_complete.
> 
> Which GLib version are/were you using? I think this was a GLib bug,
> introduced by this commit
> <http://git.gnome.org/browse/glib/commit/?id=00ee06e> and fixed by this
> commit <http://git.gnome.org/browse/glib/commit/?id=fd3ec4d>.

I notice that you filed your bug in the 10-day gap between these commits. :) I've committed a different patch to make Idle more robust against this kind of bug: <http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=ba22cc0>.

Thank you for the report!

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.