Merge lp:~ted/ubuntu-touch-session/indicator-sound-override-v2 into lp:ubuntu-touch-session

Proposed by Ted Gould
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 245
Merged at revision: 243
Proposed branch: lp:~ted/ubuntu-touch-session/indicator-sound-override-v2
Merge into: lp:ubuntu-touch-session
Diff against target: 39 lines (+27/-0)
2 files modified
upstart-session/indicator-sound.override (+15/-0)
upstart-session/pulseaudio.conf (+12/-0)
To merge this branch: bzr merge lp:~ted/ubuntu-touch-session/indicator-sound-override-v2
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
Niklas Wenzel (community) Needs Information
Review via email: mp+241640@code.launchpad.net

Commit message

Override indicator sound to wait for Pulse to be ready

Description of the change

Part duex

Leaving in the Pulse post-start condition so that other people could wait on it if they wanted. But changing indicator-sound to have the same code as a pre-start condition so it'll wait for Pulse.

To post a comment you must log in.
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Shouldn't it also wait for unity-notifications to come up in order to fix the bug you linked?
https://bugs.launchpad.net/ubuntu-rtm/+source/unity8/+bug/1389008

review: Needs Information
Revision history for this message
Ted Gould (ted) wrote :

On Sun, 2014-11-16 at 11:24 +0000, Niklas Wenzel wrote:

> Shouldn't it also wait for unity-notifications to come up in order to fix the bug you linked?

Ideally, but the problem is that we don't get any signal for that. Unity
8 reports that it is ready when the Mir socket is ready and doesn't have
any reporting about when it loads and initialize all of its individual
plugins.

Revision history for this message
Charles Kerr (charlesk) wrote :

Ted, I agree with the basic idea but the implementation looks pretty aggressive compared to the other override & conf scripts -- waking 10x per second with no timeout condition to end the loop.

On the one hand, if [ -S /run/user/`id -u`/pulse/dbus-socket ] fails then wakeups are not the most important problem we've got. OTOH we should at least have a timeout to break out of the while loop.

245. By Ted Gould

Switch to a limited loop and stop if we don't ever get the socket in 5 seconds

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'upstart-session/indicator-sound.override'
2--- upstart-session/indicator-sound.override 1970-01-01 00:00:00 +0000
3+++ upstart-session/indicator-sound.override 2014-11-20 23:06:12 +0000
4@@ -0,0 +1,15 @@
5+
6+# Ensure that Pulse is up before we are, which we unfortunately can't
7+# encode in start conditions because we might need to be started more
8+# than once where Pulse is only started once. This happens in the case
9+# of the wizard which starts and stops the indicators once and then
10+# unity restarts them
11+
12+pre-start script
13+ for num in {1..50}; do
14+ [ -S /run/user/`id -u`/pulse/dbus-socket ] && break
15+ sleep 0.1
16+ done
17+
18+ [ -S /run/user/`id -u`/pulse/dbus-socket ] || stop
19+end script
20
21=== modified file 'upstart-session/pulseaudio.conf'
22--- upstart-session/pulseaudio.conf 2014-11-12 17:46:17 +0000
23+++ upstart-session/pulseaudio.conf 2014-11-20 23:06:12 +0000
24@@ -17,3 +17,15 @@
25 end script
26
27 exec pulseaudio --start --log-target=syslog
28+
29+# Upstart tracks fork() calls, but what Pulse does is fork early
30+# and then block on a write to a socket. So Upstart thinks that
31+# it has started while Pulse is still initializing. This stops
32+# the started event from happening until the dbus-socket is ready
33+# for people to connect to it.
34+post-start script
35+ while true; do
36+ [ -S /run/user/`id -u`/pulse/dbus-socket ] && break
37+ sleep 0.1
38+ done
39+end script

Subscribers

People subscribed via source and target branches

to all changes: