Merge lp:~rodrigo-moya/ubuntuone-client/fix-613219 into lp:ubuntuone-client

Proposed by Rodrigo Moya
Status: Merged
Approved by: Roman Yepishev
Approved revision: 695
Merged at revision: 702
Proposed branch: lp:~rodrigo-moya/ubuntuone-client/fix-613219
Merge into: lp:ubuntuone-client
Diff against target: 170 lines (+44/-38)
2 files modified
libsyncdaemon/syncdaemon-daemon.c (+43/-37)
libsyncdaemon/syncdaemon-status-interface.c (+1/-1)
To merge this branch: bzr merge lp:~rodrigo-moya/ubuntuone-client/fix-613219
Reviewer Review Type Date Requested Status
Roman Yepishev (community) fieldtest Approve
Natalia Bidart (community) Approve
dobey (community) Abstain
Review via email: mp+34967@code.launchpad.net

Commit message

Don't start syncdaemon from Nautilus plugin. Just wait for it to be available

Description of the change

Don't start syncdaemon from Nautilus plugin. Just wait for it to be available

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

SyncDaemon is being started for me even with the latest libraries from this branch. Rodrigo and I made a debugging session, he is now aware of the issue.

review: Needs Fixing
Revision history for this message
dobey (dobey) wrote :

I'm inclined to reject this. Launchpad seems to be stuck trying to rescan this branch, and this proposal seems to have no diff attached.

Why is there no diff?

review: Disapprove
Revision history for this message
Roman Yepishev (rye) wrote :

STR:

1. Disable File sync service in ubuntuone-preferences; close ubuntuone-preferences
2. Launch nautilus
3. Start ubuntuone-preferences.
4. Nautilus crashes:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff36be7aa in vfprintf () from /lib/libc.so.6
(gdb) bt
#0 0x00007ffff36be7aa in vfprintf () from /lib/libc.so.6
#1 0x00007ffff3773f1c in __vasprintf_chk () from /lib/libc.so.6
#2 0x00007ffff4ad5c7b in g_vasprintf () from /lib/libglib-2.0.so.0
#3 0x00007ffff4ab4960 in g_strdup_vprintf () from /lib/libglib-2.0.so.0
#4 0x00007ffff4a9d068 in g_logv () from /lib/libglib-2.0.so.0
#5 0x00007ffff4a9d4a3 in g_log () from /lib/libglib-2.0.so.0
#6 0x00007fffdde57156 in syncdaemon_status_interface_get_current_status (interface=0xf750d0) at syncdaemon-status-interface.c:308
#7 0x00007fffde4c211e in ubuntuone_nautilus_daemon_ready (daemon=<value optimized out>, user_data=<value optimized out>) at ubuntuone-nautilus.c:1009
...

Full backtrace: http://paste.ubuntu.com/491169/

Looks like "ready" handler is called earlier than nautilus is really ready.

review: Needs Fixing (fieldtest)
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

I worked! It did! YEY!

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :
Download full text (3.9 KiB)

Following Roman's instructions, what I've got is:

(gdb) r
Starting program: /usr/bin/nautilus
[Thread debugging using libthread_db enabled]
[New Thread 0x7fffeb8d8710 (LWP 15757)]
[New Thread 0x7fffeaa86710 (LWP 15758)]
Initializing nautilus-gdu extension
[New Thread 0x7fffda57c710 (LWP 15759)]
[New Thread 0x7fffd9d7b710 (LWP 15760)]

(nautilus:15754): GConf-CRITICAL **: gconf_value_free: assertion `value != NULL' failed
[New Thread 0x7fffcfb2f710 (LWP 15761)]

(nautilus:15754): GConf-CRITICAL **: gconf_value_free: assertion `value != NULL' failed
Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory
Please ask your system administrator to enable user sharing.

[Thread 0x7fffd9d7b710 (LWP 15760) exited]
[Thread 0x7fffeaa86710 (LWP 15758) exited]

(nautilus:15754): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Message did not receive a reply (timeout by message bus)

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff36be7aa in _IO_vfprintf_internal (s=0x7fffffffcab0, format=<value optimized out>,
    ap=0x7fffffffcc80) at vfprintf.c:1614
1614 vfprintf.c: No such file or directory.
 in vfprintf.c
(gdb) where
#0 0x00007ffff36be7aa in _IO_vfprintf_internal (s=0x7fffffffcab0, format=<value optimized out>,
    ap=0x7fffffffcc80) at vfprintf.c:1614
#1 0x00007ffff3773f1c in __vasprintf_chk (result_ptr=0x7fffffffcc08, flags=1,
    format=0x7fffdc9e8908 "Error calling current_status: %s", args=0x7fffffffcc80)
    at vasprintf_chk.c:68
#2 0x00007ffff4ad5c7b in g_vasprintf () from /lib/libglib-2.0.so.0
#3 0x00007ffff4ab4960 in g_strdup_vprintf () from /lib/libglib-2.0.so.0
#4 0x00007ffff4a9d068 in g_logv () from /lib/libglib-2.0.so.0
#5 0x00007ffff4a9d4a3 in g_log () from /lib/libglib-2.0.so.0
#6 0x00007fffdc9e4156 in syncdaemon_status_interface_get_current_status (interface=0xc9a640)
    at syncdaemon-status-interface.c:308
#7 0x00007fffdd04f12e in ubuntuone_nautilus_daemon_ready (daemon=<value optimized out>,
    user_data=<value optimized out>) at ubuntuone-nautilus.c:1009
#8 0x00007ffff5385afe in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#9 0x00007ffff539e379 in ?? () from /usr/lib/libgobject-2.0.so.0
#10 0x00007ffff539faf6 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#11 0x00007ffff53a0353 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#12 0x00007ffff1f2876f in ?? () from /usr/lib/libdbus-glib-1.so.2
#13 0x00007ffff5385afe in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#14 0x00007ffff539e379 in ?? () from /usr/lib/libgobject-2.0.so.0
#15 0x00007ffff539faf6 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#16 0x00007ffff53a0353 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#17 0x00007ffff1f2988e in ?? () from /usr/lib/libdbus-glib-1.so.2
#18 0x00007ffff1ce6aa6 in dbus_connection_dispatch () from /lib/libdbus-1.so.3
#19 0x00007ffff1f1fa45 in ?...

Read more...

review: Needs Fixing
Revision history for this message
Roman Yepishev (rye) wrote :

... and the same happens with test-libsyncdaemon:

Starting program: /home/rtg/Projects/ubuntuone-client/fix-613219/libsyncdaemon/.libs/test-libsyncdaemon
[Thread debugging using libthread_db enabled]
** (/home/rtg/Projects/ubuntuone-client/fix-613219/libsyncdaemon/.libs/test-libsyncdaemon:19114): DEBUG: Syncdaemon not running, waiting for it to start in NameOwnerChanged
** (/home/rtg/Projects/ubuntuone-client/fix-613219/libsyncdaemon/.libs/test-libsyncdaemon:19114): DEBUG: Got notification of SyncDaemon startup in NameOwnerChanged
/testlibsyncdaemon/TestDaemon:
** WARNING **: Could not get syncdaemon's root dir: Message did not receive a reply (timeout by message bus)
aborting...

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff71410c2 in g_logv () from /lib/libglib-2.0.so.0
(gdb) bt
#0 0x00007ffff71410c2 in g_logv () from /lib/libglib-2.0.so.0
#1 0x00007ffff71414a3 in g_log () from /lib/libglib-2.0.so.0
#2 0x00007ffff7bcadda in syncdaemon_daemon_get_root_dir (daemon=0x60a040) at syncdaemon-daemon.c:600
#3 0x00000000004056fc in test_daemon () at test-libsyncdaemon.c:52
#4 0x00007ffff715d653 in ?? () from /lib/libglib-2.0.so.0
#5 0x00007ffff715d7c6 in ?? () from /lib/libglib-2.0.so.0
#6 0x00007ffff715daab in g_test_run_suite () from /lib/libglib-2.0.so.0
#7 0x0000000000405889 in daemon_ready_cb (daemon=..., user_data=0x7ffff79a2e40) at test-libsyncdaemon.c:499
#8 0x00007ffff73e5afe in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#9 0x00007ffff73fe379 in ?? () from /usr/lib/libgobject-2.0.so.0
#10 0x00007ffff73ffaf6 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#11 0x00007ffff7400353 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#12 0x00007ffff6ee476f in ?? () from /usr/lib/libdbus-glib-1.so.2
#13 0x00007ffff73e5afe in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#14 0x00007ffff73fe379 in ?? () from /usr/lib/libgobject-2.0.so.0
#15 0x00007ffff73ffaf6 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#16 0x00007ffff7400353 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#17 0x00007ffff6ee588e in ?? () from /usr/lib/libdbus-glib-1.so.2
#18 0x00007ffff6ca2aa6 in dbus_connection_dispatch () from /lib/libdbus-1.so.3
#19 0x00007ffff6edba45 in ?? () from /usr/lib/libdbus-glib-1.so.2
#20 0x00007ffff71367e2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#21 0x00007ffff713a748 in ?? () from /lib/libglib-2.0.so.0
#22 0x00007ffff713ac55 in g_main_loop_run () from /lib/libglib-2.0.so.0
#23 0x00000000004039ef in main (argc=1, argv=0x7fffffffe188) at test-libsyncdaemon.c:535

review: Needs Fixing (fieldtest)
Revision history for this message
dobey (dobey) wrote :

Changing to abstain. It appears launchpad is broken, and I've filed a bug and annoyed pepole about it. Hopefully it will be fixed quickly.

review: Abstain
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

In the meantime, I've fixed the crash, so please Naty, Roman, test it again

685. By Rodrigo Moya

blah

686. By Rodrigo Moya

Use a constant for DBus name

687. By Rodrigo Moya

Merge from trunk

688. By Rodrigo Moya

Move connection to NameOwnerChanged signal to a later spot

689. By Rodrigo Moya

Use NameHasOwner rather than RequestName/ReleaseName

690. By Rodrigo Moya

Set GError to NULL before using it in call to DBus

Revision history for this message
Roman Yepishev (rye) wrote :

Hm, right now test does not advance past if syncdaemon is running.

./test-libsyncdaemon
** (/home/rtg/Projects/ubuntuone-client/fix-613219/libsyncdaemon/.libs/lt-test-libsyncdaemon:11310): DEBUG: SyncDaemon already running, initializing SyncdaemonDaemon object

Test advances only when I shut down and start syncdaemon again.

Also, I can't seem to be able to force nautilus plugin to load public files list now even with status change.

review: Needs Fixing (fieldtest)
691. By Rodrigo Moya

Merge from trunk

692. By Rodrigo Moya

Emit 'ready' signal in an idle callback

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

> Hm, right now test does not advance past if syncdaemon is running.
>
> ./test-libsyncdaemon
> ** (/home/rtg/Projects/ubuntuone-client/fix-613219/libsyncdaemon/.libs/lt-
> test-libsyncdaemon:11310): DEBUG: SyncDaemon already running, initializing
> SyncdaemonDaemon object
>
> Test advances only when I shut down and start syncdaemon again.
>
> Also, I can't seem to be able to force nautilus plugin to load public files
> list now even with status change.

right, the "ready" signal was being emitted in the _init function, so callers hadn't connected to the signal yet, so they never got it. Fixed now, so please re-review

693. By Rodrigo Moya

Mark 635629 as fixed by this branch

694. By Rodrigo Moya

Merge from trunk

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

* syncdaemon is not started when nautilus is.
* test can be run, including ./libsyncdaemon/test-libsyncdaemon
* nautilus doesn't crash if opened when file synch is disabled.

review: Approve
Revision history for this message
Roman Yepishev (rye) wrote :

Unfortunately I need to set Needs Fixing again. Here's what happens now:

Clean reboot, ubuntuone-login enabled in system-wide xdg configuration, pretty much default user setup with 1K files under Ubuntu One.

1. Log in to GDM, get to desktop pretty fast.
2. Start using nautilus to navigate your folders
3. After 30 seconds ubuntuone-login starts ubuntuone-syncdaemon and nautilus freezes until syncdaemon finishes loading and starts d-bus server.

** (nautilus:2098): WARNING **: Error calling current_status: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

** (nautilus:2098): CRITICAL **: syncdaemon_status_info_get_online: assertion `SYNCDAEMON_IS_STATUS_INFO (sinfo)' failed

** (nautilus:2098): WARNING **: Could not get syncdaemon's root dir: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

** (nautilus:2098): WARNING **: Error calling get_folders: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Looks like ready is called too early, i.e. not when Syncdaemon is launched and has DBus service, but too early when it is launched. Maybe we can emit ready when a) syncdaemon is present on the bus and it emitted some DBus signal?

review: Needs Fixing
Revision history for this message
Roman Yepishev (rye) wrote :

> Maybe we can emit ready
> when a) syncdaemon is present on the bus and it emitted some DBus signal?

No, that's a bad idea since dbus signal may never be emitted. I wish there was some sort of dbus call that could say whether connection is alive w/o blocking anything...

695. By Rodrigo Moya

Merge from trunk

Revision history for this message
Roman Yepishev (rye) wrote :

Rodrigo found what's the issue - /usr/lib/ubuntuone-client/ubuntuone-syncdaemon acquires dbus name early, thus emitting ready signal. Will ask for this to change somehow in another bug report.

review: Approve (fieldtest)
Revision history for this message
Roman Yepishev (rye) wrote :

The bug report about name change is LP:639017

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libsyncdaemon/syncdaemon-daemon.c'
2--- libsyncdaemon/syncdaemon-daemon.c 2010-08-31 10:04:53 +0000
3+++ libsyncdaemon/syncdaemon-daemon.c 2010-09-15 07:49:45 +0000
4@@ -25,6 +25,7 @@
5 #include <gio/gio.h>
6 #else
7 #include <dbus/dbus-glib.h>
8+#include <dbus/dbus-glib-bindings.h>
9 #endif
10 #include "syncdaemon-daemon.h"
11 #include "syncdaemon-config-interface.h"
12@@ -36,6 +37,8 @@
13 #include "syncdaemon-status-interface.h"
14 #include "syncdaemon-marshal.h"
15
16+#define SYNCDAEMON_DBUS_NAME "com.ubuntuone.SyncDaemon"
17+
18 G_DEFINE_TYPE(SyncdaemonDaemon, syncdaemon_daemon, G_TYPE_OBJECT)
19
20 struct _SyncdaemonDaemonPrivate {
21@@ -308,17 +311,32 @@
22 g_signal_emit_by_name (daemon, "quota_exceeded", volume_info);
23 }
24
25+static gboolean
26+ready_signal_idle_cb (gpointer user_data)
27+{
28+ SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
29+
30+ g_signal_emit (daemon, daemon_signals[READY_SIGNAL], 0);
31+
32+ return FALSE;
33+}
34+
35 static void
36 setup_daemon_interface (SyncdaemonDaemon *daemon)
37 {
38 GObject *proxy = NULL;
39+
40+ if (daemon->priv->daemon_interface != NULL)
41+ g_object_unref (daemon->priv->daemon_interface);
42 daemon->priv->daemon_interface = g_object_new (SYNCDAEMON_TYPE_INTERFACE,
43 "daemon", daemon,
44 NULL);
45 proxy = syncdaemon_interface_setup_proxy (SYNCDAEMON_INTERFACE (daemon->priv->daemon_interface),
46- "com.ubuntuone.SyncDaemon", "/",
47+ SYNCDAEMON_DBUS_NAME, "/",
48 "com.ubuntuone.SyncDaemon.SyncDaemon");
49 if (proxy != NULL) {
50+ daemon->priv->ready = TRUE;
51+
52 dbus_g_proxy_add_signal (DBUS_G_PROXY (proxy), "QuotaExceeded",
53 dbus_g_type_get_map ("GHashTable",
54 G_TYPE_STRING,
55@@ -336,6 +354,10 @@
56 syncdaemon_daemon_get_publicfiles_interface (daemon);
57 syncdaemon_daemon_get_shares_interface (daemon);
58 syncdaemon_daemon_get_status_interface (daemon);
59+
60+ /* Emit the signal in an idle callback so that callers get it when syncdaemon is running
61+ and hence signal is emitted in the _init method */
62+ g_idle_add ((GSourceFunc) ready_signal_idle_cb, daemon);
63 }
64
65 }
66@@ -349,12 +371,10 @@
67 {
68 SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
69
70- if (g_strcmp0 (name, "com.ubuntuone.Syncdaemon") == 0) {
71+ if (g_strcmp0 (name, SYNCDAEMON_DBUS_NAME) == 0) {
72 if (new_owner != NULL && strlen (new_owner) > 0) {
73- daemon->priv->ready = TRUE;
74+ g_debug ("Got notification of SyncDaemon startup in NameOwnerChanged");
75 setup_daemon_interface (daemon);
76-
77- g_signal_emit (daemon, daemon_signals[READY_SIGNAL], 0);
78 } else {
79 daemon->priv->ready = FALSE;
80
81@@ -371,32 +391,9 @@
82 }
83
84 static void
85-service_started_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
86-{
87- guint return_code;
88- GError *error = NULL;
89- SyncdaemonDaemon *daemon = SYNCDAEMON_DAEMON (user_data);
90-
91- if (dbus_g_proxy_end_call (proxy, call_id, &error,
92- G_TYPE_UINT, &return_code,
93- G_TYPE_INVALID)) {
94- if (return_code == DBUS_START_REPLY_SUCCESS ||
95- return_code == DBUS_START_REPLY_ALREADY_RUNNING) {
96- daemon->priv->ready = TRUE;
97- setup_daemon_interface (daemon);
98-
99- g_signal_emit (daemon, daemon_signals[READY_SIGNAL], 0);
100- } else
101- g_warning ("Error starting SyncDaemon service: %d", return_code);
102- } else {
103- g_warning ("Error starting SyncDaemon service: %s", error->message);
104- g_error_free (error);
105- }
106-}
107-
108-static void
109 syncdaemon_daemon_init (SyncdaemonDaemon *daemon)
110 {
111+ gboolean has_owner;
112 GError *error = NULL;
113
114 daemon->priv = g_new0 (SyncdaemonDaemonPrivate, 1);
115@@ -419,11 +416,27 @@
116 return;
117 }
118
119- /* Listen to DBus for syncdaemon restarts */
120 daemon->priv->dbus_proxy = (GObject *) dbus_g_proxy_new_for_name (daemon->priv->bus,
121 "org.freedesktop.DBus",
122 "/org/freedesktop/DBus",
123 "org.freedesktop.DBus");
124+
125+ /* Check if syncdaemon is running */
126+ error = NULL;
127+ if (org_freedesktop_DBus_name_has_owner (daemon->priv->dbus_proxy, SYNCDAEMON_DBUS_NAME, &has_owner, &error)) {
128+ if (has_owner) {
129+ /* Already running, so initialize ourselves */
130+ g_debug ("SyncDaemon already running, initializing SyncdaemonDaemon object");
131+ setup_daemon_interface (daemon);
132+ } else
133+ g_debug ("Syncdaemon not running, waiting for it to start in NameOwnerChanged");
134+ } else {
135+ /* The DBus call failed, so just wait for SyncDaemon to start in name_owner_changed_cb */
136+ g_warning ("Error calling NameHasOwner: %s", error->message);
137+ g_error_free (error);
138+ }
139+
140+ /* Listen to DBus for syncdaemon restarts */
141 dbus_g_proxy_add_signal (DBUS_G_PROXY (daemon->priv->dbus_proxy), "NameOwnerChanged",
142 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
143 G_TYPE_INVALID);
144@@ -431,13 +444,6 @@
145 "NameOwnerChanged",
146 G_CALLBACK (name_owner_changed_cb),
147 daemon, NULL);
148-
149- /* Start syncdaemon to avoid DBus timeouts */
150- dbus_g_proxy_begin_call (DBUS_G_PROXY (daemon->priv->dbus_proxy), "StartServiceByName",
151- service_started_cb, daemon, NULL,
152- G_TYPE_STRING, "com.ubuntuone.SyncDaemon",
153- G_TYPE_UINT, 0,
154- G_TYPE_INVALID);
155 }
156
157 /**
158
159=== modified file 'libsyncdaemon/syncdaemon-status-interface.c'
160--- libsyncdaemon/syncdaemon-status-interface.c 2010-06-24 10:25:12 +0000
161+++ libsyncdaemon/syncdaemon-status-interface.c 2010-09-15 07:49:45 +0000
162@@ -294,7 +294,7 @@
163 /* Only call DBus method if we haven't got the status yet */
164 if (interface->priv->current_status == NULL) {
165 GHashTable *hash;
166- GError *error;
167+ GError *error = NULL;
168
169 if (dbus_g_proxy_call (DBUS_G_PROXY (interface->priv->proxy), "current_status", &error,
170 G_TYPE_INVALID,

Subscribers

People subscribed via source and target branches