Merge lp:~jamesodhunt/upstart/bug-1083723-reprise into lp:~upstart-devel/upstart/1.6

Proposed by James Hunt
Status: Merged
Merged at revision: 1397
Proposed branch: lp:~jamesodhunt/upstart/bug-1083723-reprise
Merge into: lp:~upstart-devel/upstart/1.6
Diff against target: 62 lines (+22/-3)
3 files modified
ChangeLog (+5/-0)
dbus/com.ubuntu.Upstart.xml (+3/-1)
util/telinit.c (+14/-2)
To merge this branch: bzr merge lp:~jamesodhunt/upstart/bug-1083723-reprise
Reviewer Review Type Date Requested Status
Stéphane Graber (community) Approve
Colin Watson (community) Approve
Upstart Developers Pending
Review via email: mp+138780@code.launchpad.net

Description of the change

* dbus/com.ubuntu.Upstart.xml: Restart: Add annotation to make it
  manifest this is an async call.
* util/telinit.c: restart_upstart(): Use the async call to avoid the
  client-side complaining if it detects that Upstart has severed all
  D-Bus connections in preparation for the re-exec.

To post a comment you must log in.
1399. By James Hunt

* Resync with lp:~upstart-devel/upstart/1.6.

Revision history for this message
Colin Watson (cjwatson) wrote :

I haven't checked all the generated function types, but this looks broadly reasonable to me.

review: Approve
Revision history for this message
Stéphane Graber (stgraber) wrote :

For now, it seems like it's the only way to workaround that problem.
Obviously this means that telinit won't know whether the restart was successful or not.

I'm currently finishing the tests of my dbus-events branch which adds a new Restarted event emitted right after upstart did a successful re-exec.
In the future, we'll be able to have telinit listen on the system bus (if present) and catch that Restarted signal to confirm that upstart re-exec properly.

review: Approve
Revision history for this message
Steve Langasek (vorlon) wrote :

On Fri, Dec 07, 2012 at 05:21:22PM -0000, Stéphane Graber wrote:
> For now, it seems like it's the only way to workaround that problem.
> Obviously this means that telinit won't know whether the restart was
> successful or not.

This is not a major problem. The previous interface used a signal, which
doesn't tell you whether the restart was successful or not either.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-12-07 09:44:58 +0000
3+++ ChangeLog 2012-12-07 17:12:22 +0000
4@@ -3,6 +3,11 @@
5 * init/Makefile.am:
6 - TEST_DATA_DIR: use $srcdir, not $PWD.
7 - TEST_DATA_FILES: Corrected filename.
8+ * dbus/com.ubuntu.Upstart.xml: Restart: Add annotation to make it
9+ manifest this is an async call.
10+ * util/telinit.c: restart_upstart(): Use the async call to avoid the
11+ client-side complaining if it detects that Upstart has severed all
12+ D-Bus connections in preparation for the re-exec.
13
14 2012-12-06 James Hunt <james.hunt@ubuntu.com>
15
16
17=== modified file 'dbus/com.ubuntu.Upstart.xml'
18--- dbus/com.ubuntu.Upstart.xml 2012-12-06 17:27:08 +0000
19+++ dbus/com.ubuntu.Upstart.xml 2012-12-07 17:12:22 +0000
20@@ -38,7 +38,9 @@
21 <arg name="state" type="s" direction="out" />
22 </method>
23
24- <method name="Restart"/>
25+ <method name="Restart">
26+ <annotation name="com.netsplit.Nih.Method.Async" value="true" />
27+ </method>
28
29 <!-- Signals for changes to the job list -->
30 <signal name="JobAdded">
31
32=== modified file 'util/telinit.c'
33--- util/telinit.c 2012-12-06 11:38:02 +0000
34+++ util/telinit.c 2012-12-07 17:12:22 +0000
35@@ -161,13 +161,25 @@
36 restart_upstart (void)
37 {
38 nih_local NihDBusProxy *upstart = NULL;
39+ DBusPendingCall *ret;
40
41 upstart = upstart_open (NULL);
42 if (! upstart)
43 return -1;
44
45- if (upstart_restart_sync (NULL, upstart) < 0)
46- return -1;
47+ /* Fire and forget:
48+ *
49+ * Ask Upstart to restart itself using the async interface to
50+ * avoid the client-side complaining if and when it detects that
51+ * Upstart has severed all connections to perform the re-exec.
52+ */
53+ ret = upstart_restart (upstart, NULL, NULL, NULL, 0);
54+
55+ /* We don't care about the return code, but we have to keep
56+ * the compiler happy.
57+ */
58+ if (ret != (DBusPendingCall *)TRUE)
59+ return 0;
60
61 return 0;
62 }

Subscribers

People subscribed via source and target branches

to all changes: