Re: Strange problem with telepathy gabble and g_cancellable_pop



On Wed, 2011-01-26 at 02:30 +0000, Maciej Piechotka wrote:
> I'm trying to debug problem with gabble which appeared during last few
> days but I cannot pinpoint it.
> 
> telepathy-gabble seems to be unable to connect to jabber server.
> Accoring to tcpdump no packets are sent.
> 
> Bus names (per account and per connection) are created but no object is
> exported from any of them.
> 
> I've tried with telepathy glib 0.10.2, 0.10.4 with libsoup 2.32.x and
> 2.33.x.
> 
> Does anyone can help what is the problem?
> 
> Regards

I'm not sure if the problem is with glib or telepathy but I find out
what is the problem.

The job seems to be modified concurrently so job->cancellable is
modified between if's. I've attached two patches:

- quick-and-wrong patch makes my system work but it does not check for
concurrent modification.
- 0000-Check-for-concurrent-modification-of-job-cancellable adds assert
after last if to check for modification.

Sorry for cross posting but I have really no idea where the problem is.

Regards
diff --git a/gio/gioscheduler.c b/gio/gioscheduler.c
index 61e1afc..825ccec 100644
--- a/gio/gioscheduler.c
+++ b/gio/gioscheduler.c
@@ -172,18 +172,19 @@ io_job_thread (gpointer data,
 {
   GIOSchedulerJob *job = data;
   gboolean result;
+  GCancellable *cancellable = job->cancellable;
 
-  if (job->cancellable)
-    g_cancellable_push_current (job->cancellable);
+  if (cancellable)
+    g_cancellable_push_current (cancellable);
 
   do 
     {
-      result = job->job_func (job, job->cancellable, job->data);
+      result = job->job_func (job, cancellable, job->data);
     }
   while (result);
 
-  if (job->cancellable)
-    g_cancellable_pop_current (job->cancellable);
+  if (cancellable)
+    g_cancellable_pop_current (cancellable);
 
   job_destroy (job);
 }
From 0c9853ca3b694bfe00a3cd83178ee2450781846f Mon Sep 17 00:00:00 2001
From: Maciej Piechotka <uzytkownik2 gmail com>
Date: Thu, 27 Jan 2011 11:40:57 +0000
Subject: [PATCH] Check for concurrent modification of job cancellable

---
 gio/gioscheduler.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/gio/gioscheduler.c b/gio/gioscheduler.c
index 61e1afc..c7daa41 100644
--- a/gio/gioscheduler.c
+++ b/gio/gioscheduler.c
@@ -172,18 +172,20 @@ io_job_thread (gpointer data,
 {
   GIOSchedulerJob *job = data;
   gboolean result;
+  GCancellable *cancellable = job->cancellable;
 
-  if (job->cancellable)
-    g_cancellable_push_current (job->cancellable);
+  if (cancellable)
+    g_cancellable_push_current (cancellable);
 
   do 
     {
-      result = job->job_func (job, job->cancellable, job->data);
+      result = job->job_func (job, cancellable, job->data);
     }
   while (result);
 
-  if (job->cancellable)
-    g_cancellable_pop_current (job->cancellable);
+  if (cancellable)
+    g_cancellable_pop_current (cancellable);
+  g_assert (cancellable == job->cancellable);
 
   job_destroy (job);
 }
-- 
1.7.4.rc3

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]