Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
> a summary, AFAICT: everybody agrees that splitting up the many things > in Zope toggled by debug mode would be a good thing, but > nobody has time to do it. :( Actually, on the chrism-installer-branch, we're doing something about it, and we're getting closer. Most likely, Zope 2.7 will use zdrun.py from the ZODB 3.2 CVS for process management. --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
On Tue, Jan 21, 2003 at 09:10:50PM -0500, Guido van Rossum wrote: > > > Eh? This started with your suggesting a change to ZEO/start.py, to > > > which I objected. > > > > > > Oh well. What a waste of time. > > > > Now I'm lost. > > He posted a patch to lib/python/zdaemon/Daemon.py. > > Nobody said anything about ZEO/start.py. > > You're right. :-( okay, NP... just trying to make sure i understood the discussion. a summary, AFAICT: everybody agrees that splitting up the many things in Zope toggled by debug mode would be a good thing, but nobody has time to do it. :( -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's THE TALKING ICE! (courtesy of isometric.spaceninja.com) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
On Tuesday 21 January 2003 06:45 pm, Adrian van den Dries wrote: > [Sorry about the broken thread] > > On January 20, Guido van Rossum wrote: > > You seem to forget that in debugging mode there are other things that > > happen (or not) besides logging. > > Ah, the infamous Zope side-effect, aka "other cool stuff". :-) Thanks > for the heads-up. > > > And you can log to stderr (that's what I use 99% of the time). > > But this means I can't really write a start script that works (or > makes sense) with debug mode both on and off. Redirecting stderr to > EVENT_LOG_FILE doesn't really make sense if we're detaching, and is > ugly, etc.. I could write some shell polava to figure it out, but: > > > Maybe the "debug" flag is misnamed? All it really means is "don't > > detach". > > Yes. I would much prefer an explicit flag for each, because I run a > number of dev Zopes on a number of boxes to which I only have ssh > access, and I don't want to have to remember to play games with my > stdio, or restart Zope if I restart screen, etc. > > Speaking of the (side-)effects of debug mode, what exactly are they? > Is it just the automatic re-loading of DTMLFiles and PageTemplates > from disk? There's a lot of code that gets enabled when the debug (also known as development) mode gets turned on. Most of it involves auto-refreshing things from the file system, but there are many other things. Zope generally runs *much* slower in "debug" mode then in production mode also. -Casey ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
> > Eh? This started with your suggesting a change to ZEO/start.py, to > > which I objected. > > > > Oh well. What a waste of time. > > Now I'm lost. > He posted a patch to lib/python/zdaemon/Daemon.py. > Nobody said anything about ZEO/start.py. You're right. :-( I know that file from the context of ZODB. But it is also used by Zope. I'm sorry for the confusion. --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
On Tue, Jan 21, 2003 at 08:07:01PM -0500, Guido van Rossum wrote: > > On January 21, Guido van Rossum wrote: > > > There may be a Zope debug mode, but it's not related (even if it > > > uses the same envariable). > > > > I'm sorry, I'm talking about Zope's debug mode. > > Eh? This started with your suggesting a change to ZEO/start.py, to > which I objected. > > Oh well. What a waste of time. Now I'm lost. He posted a patch to lib/python/zdaemon/Daemon.py. Nobody said anything about ZEO/start.py. -- Paul Winkler http://www.slinkp.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
> On January 21, Guido van Rossum wrote: > > There may be a Zope debug mode, but it's not related (even if it > > uses the same envariable). > > I'm sorry, I'm talking about Zope's debug mode. Eh? This started with your suggesting a change to ZEO/start.py, to which I objected. Oh well. What a waste of time. --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
On Tue, Jan 21, 2003 at 07:26:11PM -0500, Chris McDonough wrote: > z2.py -Z0 STUPID_LOG_FILE= > > ... which prevents Zope from detaching from the terminal but doesn't > imply debug mode. This may only work on recent checkouts, the semantics > of -Z have changed recently. Interesting! In 2.6.0 the -Z flag is documented thus: -Z 0 or 1 UNIX only! This option is ignored on Windows. This option controls whether a management process will be created that restarts Zope after a shutdown or crash. If the argument to -Z is non-null (e.g. "-Z1" or "-Zyes"), a management process will be used. If the argument to -Z is "-", or "0", (e.g. "-Z-" or "-Z0"), a management process will not be used. On UNIX, the default behavior is to create a separate management process (e.g. -Z1) if the -Z option is not specified. (Note: the -Z option in Zopes before Zope 2.6 used to be used to specify a pidfile name for the management process. This pidfile no longer exists). > > Speaking of the (side-)effects of debug mode, what exactly are they? > > Is it just the automatic re-loading of DTMLFiles and PageTemplates > > from disk? > > It's that... and, unfortunately, god knows what else. To find out for sure, > we'd need to audit the codebase (looking mostly for Z_DEBUG_MODE and __debug__). at least in < 2.6 it also toggled whether tracebacks were displayed openly (debug mode) or embedded in an html comment. > I'd like to address these problems for Zope 2.7, but I doubt it's going > to be possible in the short term. What he said. :( -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's THE TONGUE! (courtesy of isometric.spaceninja.com) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
[OK, I've subscribed now] On January 21, Guido van Rossum wrote: > There may be a Zope debug mode, but it's not related (even if it > uses the same envariable). I'm sorry, I'm talking about Zope's debug mode. a. -- Adrian van den Dries [EMAIL PROTECTED] Development team www.dev.flow.com.au FLOW Communications Pty. Ltd. www.flow.com.au ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
> But this means I can't really write a start script that works (or > makes sense) with debug mode both on and off. I don't think that's a valid use case anyway. Remember, "debug" mode really means "don't daemonize" and nothing more. This for use by a developer who wants to see possible exceptions, print statements and other stuff that goes to stdout/stderr. > Yes. I would much prefer an explicit flag for each, because I run a > number of dev Zopes on a number of boxes to which I only have ssh > access, and I don't want to have to remember to play games with my > stdio, or restart Zope if I restart screen, etc. > > Speaking of the (side-)effects of debug mode, what exactly are they? > Is it just the automatic re-loading of DTMLFiles and PageTemplates > from disk? I've tried to explain already -- debug mode for ZEO *only* determines whether the ZEO server goes into daemon mode or not. There may be a Zope debug mode, but it's not related (even if it uses the same envariable). --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
On January 21, Chris McDonough wrote: > It unfortunately means lots of things, all of which are implicitly > twisted together in a huge mess I wasn't going to say it. ;-) > It's that... and, unfortunately, god knows what else. To find out > for sure, we'd need to audit the codebase (looking mostly for > Z_DEBUG_MODE and __debug__). > > I'd like to address these problems for Zope 2.7, but I doubt it's going > to be possible in the short term. Hrm, a refactor, eh? adriand@pita:~/Zope-2.6.0b1-src$ egrep -Iir 'principia|bobo' * | wc -l 345 ;-) a. -- Adrian van den Dries [EMAIL PROTECTED] Development team www.dev.flow.com.au FLOW Communications Pty. Ltd. www.flow.com.au ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
[Sorry about the broken thread] On January 20, Guido van Rossum wrote: > You seem to forget that in debugging mode there are other things that > happen (or not) besides logging. Ah, the infamous Zope side-effect, aka "other cool stuff". :-) Thanks for the heads-up. > And you can log to stderr (that's what I use 99% of the time). But this means I can't really write a start script that works (or makes sense) with debug mode both on and off. Redirecting stderr to EVENT_LOG_FILE doesn't really make sense if we're detaching, and is ugly, etc.. I could write some shell polava to figure it out, but: > Maybe the "debug" flag is misnamed? All it really means is "don't > detach". Yes. I would much prefer an explicit flag for each, because I run a number of dev Zopes on a number of boxes to which I only have ssh access, and I don't want to have to remember to play games with my stdio, or restart Zope if I restart screen, etc. Speaking of the (side-)effects of debug mode, what exactly are they? Is it just the automatic re-loading of DTMLFiles and PageTemplates from disk? a. -- Adrian van den Dries [EMAIL PROTECTED] Development team www.dev.flow.com.au FLOW Communications Pty. Ltd. www.flow.com.au ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
> I understand zdaemon is going away soon, but here's a small patch to > Daemon.py to fork if it finds an EVENT_LOG_FILE. Why do you want that? Logging to a file in the background is a useful feature. [snip -- thanks for the scripts] > The non-detaching daemon, however, is just plain annoying. On Unix > you can always tail the logfile for the same effect. I do not understand this remark. Your patch *prevents* the daemon from detaching. So you find your own patch annoying? --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] [PATCH] Forking daemon in debug mode, and new start scripts
I understand zdaemon is going away soon, but here's a small patch to Daemon.py to fork if it finds an EVENT_LOG_FILE. Also included is my start/stop scripts (for Unix), and a custom_zodb.py which uses an environment variable ZODB_STORAGE to determine what storage to use. This allows me to use the same codebase for my ZEO client Zopes and local FileStorage Zopes, simply by changing a /etc/defaults style config file, also included. The scripts in their current form may not be entirely suitable, but they provide a point of departure for a slightly better startup mechanism. The non-detaching daemon, however, is just plain annoying. On Unix you can always tail the logfile for the same effect. a. -- Adrian van den Dries [EMAIL PROTECTED] Development team www.dev.flow.com.au FLOW Communications Pty. Ltd. www.flow.com.au --- Daemon.py.orig 2002-08-15 08:12:52.0 +1000 +++ Daemon.py 2003-01-20 15:59:45.0 +1100 @@ -29,7 +29,8 @@ os.environ['ZDAEMON_MANAGED']='TRUE' -if not os.environ.has_key('Z_DEBUG_MODE'): +if not (os.environ.has_key('Z_DEBUG_MODE') and +not os.environ.has_key('EVENT_LOG_FILE')): detach() # detach from the controlling terminal while 1: config.sh Description: Bourne shell script #!/bin/sh . $(dirname $0)/config.sh export ZOPE_HOME SOFTWARE_HOME INSTANCE_HOME CLIENT_HOME ZODB_STORAGE export EVENT_LOG_FILE EVENT_LOG_SEVERITY Z_DEBUG_MODE cd $ZOPE_HOME umask 077 if [ "$MONITOR_PORT" ]; then MONITOR="-m $MONITOR_PORT" fi if [ "$WEBDAV_PORT" ]; then WEBDAV="-W $WEBDAV_PORT" fi if [ "$HTTP_PORT" ]; then HTTP="-w $HTTP_PORT" fi if [ "$FTP_PORT" ]; then FTP="-f $FTP_PORT" fi exec python2.1 $ZOPE_HOME/z2.py -X $HTTP $FTP $WEBDAV $MONITOR "$@" #! /bin/sh . $(dirname $0)/config.sh kill $(cat $ZOPE_HOME/var/Z2.pid) import os ZODB_STORAGE = os.environ.get('ZODB_STORAGE', '') if not ZODB_STORAGE: raise "NoStorageInEnvironmentError" try: stg = eval(ZODB_STORAGE) except: stg = ZODB_STORAGE if type(stg) is type(''): from ZODB.FileStorage import FileStorage Storage = FileStorage(stg) else: from ZEO.ClientStorage import ClientStorage Storage = ClientStorage(stg, name='ZEO server on %s' % stg[0])