(Re: Debian bug report #479346 - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=479346) (Copying over to the bug report itself, please send copies of your replies as well)
The cherokee-admin program is a nice and nifty tool... But it lacks some polish which can easily scare away users. This bug report is a very good example: cherokee-admin launches a statically configured Cherokee server, running the admin program via a SCGI connection... Statically configured to be at TCP port 4000: cherokee/admin_main.c line 74: RULE "1!handler!balancer!local1!host = localhost:4000\n" Granted, we cannot expect much configurability from the configurator, right? :-) The choice of port 4000 is IMHO unfortunate, as it is a common port for local use. And it is not documented at all. But the real problem is the conflict is not reported - The user just gets a «500 Internal Server Error» message, but nothing in the console. I just talked with Álvaro, and he agrees that it's a good (and simple to implement) idea for cherokee-admin to check if the port is available upon invocation, and send a prominent message to the user in the console, refusing to run. But in any case, a more robust method would be very nice to have: Would any of you feel like coding a failover mechanism, that looks for a free port? I am completely unfamiliar with the mechanism, so I'd rather ask for a patch than write one myself ;-) In the meantime, I'm modifying the Debian package, so instead of binding to such a popular port (at least it conflicts with mldonkey) it binds to something else... say, port 31337? No, I guess that's popular as well ;-) Well, a random high number. Of course, I'll check it. And, just for extra points: When you want to close the cherokee-admin session, you kill the process with an innocuous Ctrl-C, right? Well, the only problem is it looks as if we hit an error: $$ /usr/sbin/cherokee-admin Cherokee Web Server 0.6.1 (May 5 2008): Listening on port 9090, TLS disabled IPv6 disabled, using epoll, 1024 fds system limit, max. 502 connections 10 threads, 105 fds per thread, standard scheduling policy Server running.. PID=7355 Traceback (most recent call last): File "/usr/share/cherokee/admin/server.py", line 164, in <module> main() File "/usr/share/cherokee/admin/server.py", line 158, in main srv.handle_request() File "/usr/lib/python2.5/SocketServer.py", line 217, in handle_request request, client_address = self.get_request() File "/usr/lib/python2.5/SocketServer.py", line 374, in get_request return self.socket.accept() File "/usr/lib/python2.5/socket.py", line 167, in accept sock, addr = self._sock.accept() KeyboardInterrupt So, of course, this is just matter of anticipating we will be terminated by a Ctrl-C, avoiding a head-scratching user ;-) So, would anybody object to this? (I'm submitting it to the list as I'm a complete python newbie, and I don't grok cherokee internals) Index: cherokee-0.7.1/admin/server.py =================================================================== --- cherokee-0.7.1.orig/admin/server.py 2008-06-11 14:54:46.000000000 -0500 +++ cherokee-0.7.1/admin/server.py 2008-06-11 14:55:56.000000000 -0500 @@ -158,11 +158,14 @@ cfg = Config(cfg_file) print ("Server running.. PID=%d" % (os.getpid())) - while True: - # Do it - srv.handle_request() + try: + while True: + # Do it + srv.handle_request() - srv.server_close() + srv.server_close() + except KeyboardInterrupt: + print "Server exiting..." if __name__ == '__main__': main() I hope it makes sense (I have not even tested it yet ;-) ) Thank you, -- Gunnar Wolf - [EMAIL PROTECTED] - (+52-55)5623-0154 / 1451-2244 PGP key 1024D/8BB527AF 2001-10-23 Fingerprint: 0C79 D2D1 2C4E 9CE4 5973 F800 D80E F35A 8BB5 27AF
signature.asc
Description: Digital signature