2009/7/13 Aslan <cocoke...@gmail.com>:
>
> Hi,
>
> I meet a problem about CheeryPy and WSGIDaemonProcess. If you can
> help, please give me some suggestions, THANKS!!!!
>
> I have a program which is built with CherryPy, it is very easy and
> shown as following...
>
> ===============================================
> #cherry.py
> import sys
> sys.stdout = sys.stderr

You don't need this as you set:

  WSGIRestrictStdout Off

> import atexit
> import threading
> import cherrypy
>
> cherrypy.config.update({'environment': 'embedded'})
>
> class Root(object):
>        def index(self):
>                book = {}
>                for item in range(5000):
>                        book[item] = {"name": item, "path": 
> "/i-data/md0/public/" +
> item.__str__()}
>                return book.__str__()
>        index.exposed = True
>
> application = cherrypy.Application(Root(), None)
> ===============================================
>
> And I set my httpd.conf as ...
> ===============================================
> #httpd.conf
> <Directory /i-data/md0/public/aslantest>
> WSGIApplicationGroup %{GLOBAL}
> WSGIProcessGroup aslan
> Order allow,deny
> Allow from all
> </Directory>
>
> WSGISocketPrefix /tmp/wsgi

Don't put the daemon listener sockets under /tmp. If you are on Linux
system which has changed permissions on Apache runtime directory
(logs) directory so not readable to others, then you can normally set
this as:

  WSGISocketPrefix run/wsgi

Note there is no leading slash.

In:

  http://code.google.com/p/modwsgi/wiki/ConfigurationIssues

it explicitly says:

"""Note, do not put the sockets in the system temporary working
directory. That is, do not go making the prefix '/tmp/wsgi'. The
directory should be one that is only writable by 'root' user, or if
not starting Apache as 'root', the user that Apache is started as."""

> WSGIDaemonProcess aslan display-name=%{GROUP} processes=1 threads=10

Don't set 'processes=1'. Leave that option out. The default is one
process anyway, and using 'processes' option, even if set to 1, has
side effect of setting wsgi.multiprocess to True, which will stop in
browser code debuggers for WSGI working.

> WSGIImportScript /i-data/md0/public/aslantest/cherry.py process-
> group=aslan application-group=%{GLOBAL}
>
> WSGIRestrictStdout Off
> WSGIScriptAlias /aslantest /i-data/6fadd30c/public/aslantest/cherry.py
> ===============================================
>
> And now, I start httpd and see...
> ===============================================
>  9523 root       5364 S   /usr/sbin/httpd -f /etc/service_conf/
> httpd.conf
>  9526 nobody     8400 S   (wsgi:aslan)    -f /etc/service_conf/
> httpd.conf
>  9527 nobody     4536 S   /usr/sbin/httpd -f /etc/service_conf/
> httpd.conf
>  9528 nobody     4524 S   /usr/sbin/httpd -f /etc/service_conf/
> httpd.conf
>  9588 root        448 S   grep httpd
> ===============================================
>
> All of that is right until now! But...
> I connect this application by my web browser, and see httpd again...
> ===============================================
> 9523 root       5364 S   /usr/sbin/httpd -f /etc/service_conf/
> httpd.conf
>  9526 nobody     8400 S   (wsgi:aslan)    -f /etc/service_conf/
> httpd.conf
>  9527 nobody     4968 S   /usr/sbin/httpd -f /etc/service_conf/
> httpd.conf
>  9528 nobody     4968 S   /usr/sbin/httpd -f /etc/service_conf/
> httpd.conf
>  9769 nobody     9572 S   /usr/sbin/httpd -f /etc/service_conf/
> httpd.conf
> 10755 root        448 S   grep httpd
> ===============================================
>
> The memory usage of the process 9769 up to 9572. This means
> WSGIDaemonProcess doesn't work correctly.
>
> Does anyone know where I am wrong?

I know you already found the problem, but have a read of:

  http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode

It tells you how to determine if application is running either
embedded mode or daemon mode using a test WSGI application.

If you know you are never going to want to use embedded mode, then set
at global scope on Apache configuration:

  WSGIRestrictEmbedded On

This will block you from accidentally configuring things wrongly and
having your application bloat out all the Apache server child
processes.

Graham

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to modwsgi@googlegroups.com
To unsubscribe from this group, send email to 
modwsgi+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to