I'm using apache2 with mod_wsgi to host several different sites on the same
server.  I'm using VirtualHost directives to define each site, and I'm
running a separate WSGI process (with a different application) for each.
 The strange thing I'm running into is that all log files defined for all
VirtualHosts (access.log and error.log files) are open in all WSGI
applications.  This means one application can interfere with another's log
files, even if the two applications are running in different WSGI processes
with different UIDs and GIDs.

I observed this behavior by looking in /proc/<pid>/fd, where <pid> is the
PID of my WSGI process (which I was able to find because I provided the
display-name argument to WSGIDaemonProcess, see below).

What I'd like to know is
(a) Is this known behavior?
(b) If known, is it intentional?
(c) Is there a configuration parameter which causes apache or mod_wsgi to
close these file descriptors before calling my WSGI process?
(d) If not, is there a way my WSGI application can find out which file
descriptors it needs to keep open, so I can close the rest? (without
resorting to lots of calls to stat() or looking at /proc/<pid>/fd)
 Experimentally, it looks like one pipe and one socket that are open need to
be kept open, and the rest are unused.

For each site, I have an apache config file like the following in
/etc/apaches/sites-available (and enabled in sites-enabled).  Testapp is an
example of one application name; imagine a few copies of this with different
names substituted in for testapp.

<VirtualHost *:80>
   ServerName testapp.sundresh.org
   ServerAdmin [email protected]

   DocumentRoot /var/www/testapp/content

   WSGIScriptAlias / /var/www/testapp/code/wsgi.py
   WSGIDaemonProcess testapp display-name=testapp user=#100103 group=#100102
processes=1 threads=1 umask=0077 home=/var/www/testapp
   WSGIProcessGroup testapp
   WSGIScriptReloading Off
   <Directory /var/www/testapp>
      AllowOverride None
      Order allow,deny
      Allow from all
   </Directory>

   ErrorLog /var/log/testapp/error.log
   CustomLog /var/log/testapp/access.log combined
</VirtualHost>

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

Reply via email to