Mailing List Archive

Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline
Status: New
Owner: ----

New issue 527 by ammacdon: unable to stop or restart cherokee from gui or
commandline
http://code.google.com/p/cherokee/issues/detail?id=527

What steps will reproduce the problem?
1. 'cd /usr/ports/www/cherokee; make install clean'
2. '/usr/local/etc/rc.d/cherokee start' or 'cherokee-admin'
3. click "stop server" or "hard restart" in cherokee-admin,
or '/usr/local/etc/rc.d/cherokee restart' or stop

What is the expected output? What do you see instead?
expected output: server should stop or restart relatively quickly

cherokee-admin: shows up fine, interface works fine, example page works
fine. when choosing to stop or restart the server, the webpage hangs,
then returns: "504 Gateway Timeout"

'/usr/local/etc/rc.d/cherokee restart|stop': returns the following:
# /usr/local/etc/rc.d/cherokee restart
Stopping cherokee.
Waiting for PIDS: 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007,
1007, 1007, 1007… ad infinitum

the only way to restart cherokee is to execute 'kill -9' the cherokee &
cherokee.worker PIDs, and 'rm /var/run/cherokee.pid;
/usr/local/etc/rc.d/cherokee start'


What version of the product are you using? On what operating system?
Cherokee 0.99.20 from ports
FreeBSD 7.2-RELEASE-p2


this problem seems very similar to this report on the mailing list:
http://groups.google.com/group/cherokee-http/msg/96c054f67ea7cacf
however, the pid list in this case is unending.


Please provide any additional information below.

# cherokee -i
Compilation
Version: 0.99.20
Compiled on: Jul 13 2009 13:19:51
Arguments to
configure: '--with-wwwroot=/usr/local/www/cherokee' '--localstatedir=/var' '--disable-static' '--with-mysql=no' '--with-
ldap=no' '--with-geoip=yes' '--with-ffmpeg=no' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=i386-
portbld-freebsd7.2' 'build_alias=i386-portbld-freebsd7.2' 'CC=cc' 'CFLAGS=-O2
-fno-strict-aliasing
-pipe -Wl,-rpath,/usr/local/lib' 'LDFLAGS=-
L/usr/local/lib -pthread
-rpath=/usr/local/lib' 'CPPFLAGS=-I/usr/local/include ' 'CXX=c++' 'CXXFLAGS=-O2
-fno-strict-aliasing -pipe -Wl,-
rpath,/usr/local/lib'

Installation
Deps dir: /usr/local/share/cherokee/deps
Data dir: /usr/local/share/cherokee
Icons dir: /usr/local/share/cherokee/icons
Themes dir: /usr/local/share/cherokee/themes
Plug-in dir: /usr/local/lib/cherokee

Plug-ins
Built-in:

Support
IPv6: yes
Pthreads: yes
Tracing: no
sendfile(): yes
syslog(): yes
Polling methods: select poll kqueue

# uname -a
FreeBSD rev.arch.office 7.2-RELEASE-p2 FreeBSD 7.2-RELEASE-p2 #0: Wed Jun
24 00:57:44 UTC 2009 root@i386-
builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #2 on issue 527 by dschulz: unable to stop or restart cherokee from
gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

still experiencing the same behavior running on FreeBSD.
cherokee daemon (not worker) stops normally if it was started from rc
script (without
--admin-child flag) but not otherwise.

/usr/local/etc/rc.d/cherokee stop
Stopping cherokee.
Waiting for PIDS: 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850,
95850,
95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850,
95850, 95850,
95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850,
95850, 95850,
95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850 ...

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #3 on issue 527 by dschulz: unable to stop or restart cherokee from
gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

Still experiencing the same behavior running on FreeBSD 7-STABLE, Cherokee
1.0.0.
cherokee daemon (not worker) stops normally if it was started from rc
script (without
--admin-child flag) but not otherwise.

/usr/local/etc/rc.d/cherokee stop
Stopping cherokee.
Waiting for PIDS: 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850,
95850,
95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850,
95850, 95850,
95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850,
95850, 95850,
95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850, 95850 ...

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #4 on issue 527 by skarcha: unable to stop or restart cherokee from
gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

Issue 770 has been merged into this issue.

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #5 on issue 527 by westernslopenews: unable to stop or restart
cherokee from gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

I'm using FreeBSD8 and also experiencing this problem.

This is going to fall under the dumb question category because I'm not a
programmer. When rc.d launches cherokee (like when you first boot up) it
starts it with the -d flag. This can be cleanly stopped via the
cherokee-admin interface.

"-d, --detach
Launches the server as a background process (default behavior is to stay
attached to the controlling terminal)."

But if you look at how cherokee-admin launches cherokee (in
/admin/Cherokee.py) it doesn't invoke this flag.

# Launch the process
p = Popen ([CHEROKEE_SERVER, '--admin_child', '-C', CTK.cfg.file],
stdout=PIPE, stderr=PIPE, env=environ,
preexec_fn=daemonize, close_fds=True)

When you launch Cherokee via cherokee-admin it can't be stopped in the
interface. So would adding the -d flag have any affect on this problem? The
problem seems to be related to how cherokee-admin is starting cherokee vs
other methods. Once cherokee-admin launches cherokee it can no longer be
stopped.

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #6 on issue 527 by rezny.michal: unable to stop or restart cherokee
from gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

- I have tried several experiments with process invoking command,
westernslopenews have mentioned, but it won't help. Neither adding '-d'
flag nor removing '--admin_child' helped.

- I have also compared rights of individual processes and of the pid file,
but there was no difference:

(via /usr/local/etc/rc.d/cherokee)
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 57093 0.0 0.0 8688 2188 ?? Is 3:03PM 0:00.00
/usr/local/sbin/cherokee -C /usr/local/etc/cherokee/cherokee.conf -d
www 57094 0.0 0.0 76332 11144 ?? I 3:03PM 0:00.05
/usr/local/sbin/cherokee-worker -C /usr/local/etc/cherokee/cherokee.conf

(via cherokee-admin)
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 57118 0.0 0.0 8688 2188 ?? Is 3:13PM 0:00.01
/usr/local/sbin/cherokee --admin_child -C
/usr/local/etc/cherokee/cherokee.conf
www 57120 0.0 0.0 74284 11084 ?? I 3:13PM 0:00.03
/usr/local/sbin/cherokee-worker --admin_child -C
/usr/local/etc/cherokee/cherokee.conf

- Changing server permissions to root/wheel won't help as well.

- As I understand this is solely FreeBSD problem. (Comment #1 is
irrelevant, I think, since both pid and log files are created in both
cases).

- Summary: Stopping/Restarting is not possible, when Cherokee is started
via cherokee-admin (you can do it only by killing cherokee process). When
invoked via startup script, it works as expected.

(Tested on FreeBSD 8.0-RELEASE-p4 with Cherokee version: 1.0.7)

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #7 on issue 527 by ammac...@gmail.com: unable to stop or restart
cherokee from gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

i'm still having this problem on freebsd 8. here's an awful workaround i've
been using:

pkill -9 -i uwsgi ; /usr/local/etc/rc.d/cherokee stop ; sleep 2 ;
/usr/local/etc/rc.d/cherokee start ; sleep 2 ; curl -s www.mysite.com >>
/dev/null


_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #8 on issue 527 by ammac...@gmail.com: unable to stop or restart
cherokee from gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

On FreeBSD 8.1-RELEASE-p1, I've been successfully using the new uwsgi from
ports.

# /usr/local/sbin/cherokee-worker --version
Cherokee Web Server 1.0.9

# /usr/local/bin/uwsgi --version
uWSGI 0.9.6.5


This works:

# /usr/local/etc/rc.d/uwsgi stop
Stopping uwsgi.
# /usr/local/etc/rc.d/cherokee restart
Stopping cherokee.
Server is exiting..
Waiting for PIDS: 33641PID 35926: exited re=0
.
Starting cherokee.
#/usr/local/etc/rc.d/uwsgi start
Starting uwsgi.


This hangs forever:
# /usr/local/etc/rc.d/cherokee restart
Stopping cherokee.
Server is exiting..
Waiting for PIDS: 33642…………………………………………………….


I'm assuming because cherokee has problems with restarting uwsgi?

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #9 on issue 527 by robe...@unbit.it: unable to stop or restart
cherokee from gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

I have investigated on this.
Cherokee sends the SIGTERM to the uWSGI master and expect it to die after
it.
The problem is that uWSGI map SIGTERM to "brutal reload", so the process
simply
change its exec image but maintain the same pid. This will put cherokee
sleep on the wait() call. I see a couple of way to follow:

1) use waitpid() and wait for a maximum of N seconds. After this time,
simply send a SIGKILL.

2) Send SIGQUIT if the source is of type "uwsgi"

Another approach would be working on the uWSGI side and allows it to remap
signal to specific handlers via command line/configurations file.



_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #10 on issue 527 by alobbs: unable to stop or restart cherokee from
gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

Hi Roberto! :-)

>> Cherokee sends the SIGTERM to the uWSGI master and expect it to die
>> after it.

Well, that is a pretty conservative assumption, isn't it? I mean, besides
being the standard behavior, it's actually what anyone would expect from a
process (die when SIGTERM is sent).

I'm not sure what's the best approach here (less bad?). We could add a
configuration parameter to specify the signal we want to send to kill the
process, although it'd raise the complexity of the server and specially the
configuration interface, when uWSGI is the only back-end that would use it.

I will try to think of something to fix up this issue. Meanwhile, any
suggestion is more than welcome.

Cheers!

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #11 on issue 527 by robe...@unbit.it: unable to stop or restart
cherokee from gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

What about setting an environment variable for every local source ?

Something like CHEROKEE=1 or CHEROKEE=pid (where pid is the pid of the
master process).

In this way apps can know if they are run by cherokee and eventually tune
themself.

(in the uWSGI case i can simply remap SIGTERM to the exit() and surely some
other magic)

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #12 on issue 527 by Fernando...@gmail.com: unable to stop or
restart cherokee from gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

I have the same problem on OpenBSD 5.0 and Cherokee 1.2.101.
The problem is that the cherokee process launched by cherokee-admin is a
ghost, I can't kill it, so the webgui can't stop cherokee.

I think the problem is in the code (Cherokee.py, line 132):

# Launch the process
p = Popen ([CHEROKEE_SERVER, '--admin_child', '-C', CTK.cfg.file],
stdout=PIPE, stderr=PIPE, env=environ,
preexec_fn=daemonize, close_fds=True)

If I run the command from the console, it works ok, so the problem is when
the cherokee process is launched from cherokee-admin.

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 527 in cherokee: unable to stop or restart cherokee from gui or commandline [ In reply to ]
Comment #13 on issue 527 by Fernando...@gmail.com: unable to stop or
restart cherokee from gui or commandline
http://code.google.com/p/cherokee/issues/detail?id=527

Hi all,
Again trying run the last version of cherokee on OpenBSD, now, I have more
information.

The problem is not in the admin code, the issue is with the cherokee
server, when it start does not catch the kill signals, so the web admin
can't kill it.

If I run the server from the console and press Ctrl+C , the server does not
stop:

bash-4.2# /usr/local/sbin/cherokee --admin_child -C
/etc/cherokee/cherokee.conf
Cherokee Web Server 1.2.101 (Jul 13 2012): Listening on port ALL:80, TLS
disabled, IPv6 disabled, using kqueue, 4096 fds system limit, max. 2041
connections, 5 threads, 408 connections per thread, standard scheduling
policy
^CServer is exiting..
^C
^C
^C
^C
^C
...

I don't know Why, but that's the problem, because with another
version(Cherokee Web Server 1.0.14 ), it's kill inmediatly:

# /usr/local/sbin/cherokee --admin_child -C /etc/cherokee/cherokee.conf
Cherokee Web Server 1.0.14 (Feb 7 2012): Listening on ports ALL:200,
ALL:80,
TLS disabled, IPv6 disabled, using kqueue, 4096 fds system limit, max.
2041 connections, caching I/O, 5 threads, 408 connections per thread,
standard scheduling policy
^CServer is exiting..
Server is exiting..
#

I'm running the cherokee versions (1.2.101 and 1.0.14) on OpenBSD/i386 5.1
(last stable).

Some hints?, some idea why the server can't catch the signals?

Thanks in advanced

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev