Restart option in supervisor init script does not work

Bug #1163753 reported by Javier Candeira
34
This bug affects 9 people
Affects Status Importance Assigned to Milestone
supervisor (Debian)
Fix Released
Unknown
supervisor (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Supervisord does not restart when invoked via `# /etc/init.d/supervisor restart` or `# service supervisor restart`

Its PID stays the same. Manually stopping, then starting the package works, but management tools break if they depend on `restart` working.

This is a documented bug from Debian, where the package originates and there is a patch available, although maintainer seems to be MIA:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609457

I copy from the Debian bug report:

> The start-stop-daemon does not find running instances
and so some conditionals in the script don't work.

> Another side-effect is that the pidfile gets removed
when invoking the script with "start" and supervisord is already running.

I have applied the patch from the Debian bug report, and it works. Here's my own patch after applying and testing:

diff --git a/supervisor b/supervisor
index 334d4c6..05f28e1 100755
--- a/supervisor
+++ b/supervisor
@@ -91,7 +91,7 @@ case "$1" in
   start)
  echo -n "Starting $DESC: "
  start-stop-daemon --start --quiet --pidfile $PIDFILE \
- --exec $DAEMON -- $DAEMON_OPTS
+ --startas $DAEMON -- $DAEMON_OPTS
  test -f $PIDFILE || sleep 1
         if running ; then
             echo "$NAME."
@@ -132,18 +132,17 @@ case "$1" in
  # just the same as "restart" except that it does nothing if the
  # daemon isn't already running.
  # check wether $DAEMON is running. If so, restart
- start-stop-daemon --stop --test --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON \
+ start-stop-daemon --stop --test --quiet --pidfile $PIDFILE\
+ --startas $DAEMON \
  && $0 restart \
  || exit 0
  ;;
   restart)
     echo -n "Restarting $DESC: "
- start-stop-daemon --stop --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON
+ start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
  [ -n "$DODTIME" ] && sleep $DODTIME
- start-stop-daemon --start --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
+ start-stop-daemon --start --quiet --pidfile $PIDFILE\
+ --startas $DAEMON -- $DAEMON_OPTS
  echo "$NAME."
  ;;
   status)

More data:

$ lsb_release -rd
Description: Ubuntu 12.04.2 LTS
Release: 12.04

$ apt-cache policy supervisor
supervisor:
  Installed: 3.0a8-1.1
  Candidate: 3.0a8-1.1

$ apt-rdepends supervisor
(...)
supervisor
  Depends: python (>= 2.3)
  Depends: python-medusa (>= 0.5.4)
  Depends: python-meld3
  Depends: python-pkg-resources (>= 0.6c7)
  Depends: python-support (>= 0.90.0)
(...)

Revision history for this message
Javier Candeira (javier-0) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch for the /etc/init.d/supervisor script" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in supervisor (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Javier Candeira (javier-0) wrote : Re: [Bug 1163753] Re: Restart option in supervisor init script does not work
Download full text (4.0 KiB)

Hi, Brian. Thanks for triaging my bug.

I see you have changed some things in my bug report. Apart from
tagging it with "patch", is there anything I could have done?

Thanks,

Javier

On Tue, Apr 9, 2013 at 12:58 AM, Brian Murray <email address hidden> wrote:
> ** Bug watch added: Debian Bug tracker #609457
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609457
>
> ** Also affects: supervisor (Debian) via
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609457
> Importance: Unknown
> Status: Unknown
>
> ** Changed in: supervisor (Ubuntu)
> Status: New => Triaged
>
> ** Changed in: supervisor (Ubuntu)
> Importance: Undecided => Medium
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1163753
>
> Title:
> Restart option in supervisor init script does not work
>
> Status in “supervisor” package in Ubuntu:
> Triaged
> Status in “supervisor” package in Debian:
> Unknown
>
> Bug description:
> Supervisord does not restart when invoked via `#
> /etc/init.d/supervisor restart` or `# service supervisor restart`
>
> Its PID stays the same. Manually stopping, then starting the package
> works, but management tools break if they depend on `restart`
> working.
>
> This is a documented bug from Debian, where the package originates and there is a patch available, although maintainer seems to be MIA:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609457
>
> I copy from the Debian bug report:
>
> > The start-stop-daemon does not find running instances
> and so some conditionals in the script don't work.
>
> > Another side-effect is that the pidfile gets removed
> when invoking the script with "start" and supervisord is already running.
>
> I have applied the patch from the Debian bug report, and it works.
> Here's my own patch after applying and testing:
>
> diff --git a/supervisor b/supervisor
> index 334d4c6..05f28e1 100755
> --- a/supervisor
> +++ b/supervisor
> @@ -91,7 +91,7 @@ case "$1" in
> start)
> echo -n "Starting $DESC: "
> start-stop-daemon --start --quiet --pidfile $PIDFILE \
> - --exec $DAEMON -- $DAEMON_OPTS
> + --startas $DAEMON -- $DAEMON_OPTS
> test -f $PIDFILE || sleep 1
> if running ; then
> echo "$NAME."
> @@ -132,18 +132,17 @@ case "$1" in
> # just the same as "restart" except that it does nothing if the
> # daemon isn't already running.
> # check wether $DAEMON is running. If so, restart
> - start-stop-daemon --stop --test --quiet --pidfile \
> - /var/run/$NAME.pid --exec $DAEMON \
> + start-stop-daemon --stop --test --quiet --pidfile $PIDFILE\
> + --startas $DAEMON \
> && $0 restart \
> || exit 0
> ;;
> restart)
> echo -n "Restarting $DESC: "
> - start-stop-daemon --stop --quiet --pidfile \
> - /var/run/$NAME.pid --exec $DAEMON
> + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
> [ -n "$DODTIME" ] && sleep $DODTIME
> - start-stop-daemon --sta...

Read more...

Changed in supervisor (Debian):
status: Unknown → New
Changed in supervisor (Debian):
status: New → Fix Released
Revision history for this message
fqj1994 (fqj1994) wrote :

latest patch backported from Debian sid confirmed a fix.
Please do a SRU, thanks.

Revision history for this message
Daniel Holbach (dholbach) wrote :

Should be fixed with the sync of bug 1206474.

Changed in supervisor (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.