Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

unable to stop or restart cherokee from gui or commandline #518

Open
Borkason opened this Issue · 11 comments

1 participant

@Borkason
Collaborator

Original author: ammac...@gmail.com (July 13, 2009 22:34:21)

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

Original issue: http://code.google.com/p/cherokee/issues/detail?id=527

@Borkason
Collaborator

From michael....@gmail.com on August 04, 2009 21:03:07
I had exactly the same error on Linux btw. when I configured cherokee to run under a
different user id than root. The directory permissions were wrong and it couldn't
write PID-File or Log Files...

@Borkason
Collaborator

From dsch...@gmail.com on May 11, 2010 15:16:44
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 ...

@Borkason
Collaborator

From westerns...@gmail.com on July 27, 2010 21:32:57
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.

@Borkason
Collaborator

From rezny.mi...@gmail.com on August 18, 2010 13:39:45

  • 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 (Github: #81) 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)

@Borkason
Collaborator

From ammac...@gmail.com on August 22, 2010 17:11:11
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
@Borkason
Collaborator

From ammac...@gmail.com on November 28, 2010 22:45:47
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?

@Borkason
Collaborator

From roberto....@gmail.com on November 29, 2010 07:55:51
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.

@Borkason
Collaborator

From alobbs on November 29, 2010 21:34:58
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!

@Borkason
Collaborator

From roberto....@gmail.com on November 30, 2010 13:37:56
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)

@Borkason
Collaborator

From Fernando...@gmail.com on December 21, 2011 17:40:15
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.

@Borkason
Collaborator

From Fernando...@gmail.com on July 14, 2012 03:24:41
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.