Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 178992 - www-servers/varnish init script fails to stop processes
Summary: www-servers/varnish init script fails to stop processes
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Thilo Bangert (RETIRED) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-18 11:57 UTC by Matthew Lawrence
Modified: 2007-06-11 23:01 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for files/varnishd.initd (varnish_init.patch,668 bytes, patch)
2007-05-18 12:01 UTC, Matthew Lawrence
Details | Diff
another patch (varnishd-initd.patch,438 bytes, patch)
2007-05-19 05:03 UTC, Jukka Ruohonen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Lawrence 2007-05-18 11:57:36 UTC
The init script that is installed with varnish is able to start the daemon, but not stop it.

Reproducible: Always

Steps to Reproduce:
1. sudo /etc/init.d/varnishd start
2. sudo /etc/init.d/varnishd stop
3. ps -fC varnishd

Actual Results:  
Some varnishd processes are listed

Expected Results:  
No varnishd processes should be listed

The pidfile referred to in the start-stop-daemon lines in the script isn't created by varnishd. I've got it to work by removing the --pidfile flags and using "--stop --name varnishd" to stop the daemon, but I'm not sure if that's the best solution.
Comment 1 Matthew Lawrence 2007-05-18 12:01:35 UTC
Created attachment 119588 [details, diff]
Patch for files/varnishd.initd

This is what I've changed in a local overlay to get this to work as expected.
Comment 2 Jukka Ruohonen 2007-05-19 05:03:47 UTC
Created attachment 119671 [details, diff]
another patch

Since the pid-file should always be created, I think a better way to do this is to pass the --make-pidfile with the initscript. The example patch included as an attachment also hides the unneccessary messages during startup. Can you test whether it works for you?
Comment 3 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2007-05-19 12:04:43 UTC
i appreciate your feedback!
the pidfile stuff doesn't work as expected here... 

this is the patch i applied:
@@ -9,12 +9,12 @@

 start() {
        ebegin "Starting varnish"
-       start-stop-daemon --quiet --start --pidfile /var/run/varnishd.pid --exec /usr/sbin/varnishd -- ${VARNISHD_OPTS}
+       start-stop-daemon --quiet --start --exec /usr/sbin/varnishd -- ${VARNISHD_OPTS} &> /dev/null
        eend $?
 }

 stop() {
        ebegin "Stopping varnish"
-       start-stop-daemon --quiet --stop --pidfile /var/run/varnishd.pid
+       start-stop-daemon --quiet --stop --name varnishd
        eend $?
 }


does that work for you?
Comment 4 Matthew Lawrence 2007-05-21 11:41:13 UTC
(In reply to comment #2)
> Created an attachment (id=119671) [edit]
> another patch
> 
> Since the pid-file should always be created, I think a better way to do this is
> to pass the --make-pidfile with the initscript. The example patch included as
> an attachment also hides the unneccessary messages during startup. Can you test
> whether it works for you?
> 

I just tried that here, but the process in the generated pidfile didn't exist.

  $ sudo /etc/init.d/varnishd start
  $ ls -l /var/run/varnishd.pid
  -rw-r--r-- 1 root root 6 2007-05-21 12:29 /var/run/varnishd.pid

  $ ps -fp `<!$`
  ps -fp `</var/run/varnishd.pid`
  UID        PID  PPID  C STIME TTY          TIME CMD

  $ cat /var/run/varnishd.pid
  26453

  $ ps -fC varnishd
  UID        PID  PPID  C STIME TTY          TIME CMD
  root     26484     1  0 12:29 ?        00:00:00 /usr/sbin/varnishd ...
  root     26485 26484  0 12:29 ?        00:00:00 /usr/sbin/varnishd ...

Matt
Comment 5 Matthew Lawrence 2007-05-29 15:34:13 UTC
FYI:

varnish 1.0.4 (released 20 May 2007) has support for pidfiles. (-P option to varnishd)

It also now supports daemonising varnishlog (also with pidfile support).
Comment 6 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2007-06-11 23:01:49 UTC
Thanks for the input. The new init script in cvs creates and uses the pidfile - I did not bump the latest release, please simply remerge.