2008/10/20 henrybaxter <[EMAIL PROTECTED]>:
>
> Hi,
>
> I have the following apache configuration on a server:
>
> WSGIDaemonProcess drat user=www-data group=www-data processes=6
> threads=15 python-path=/var/code/:/var/code/drat/
> # example1.com
> Listen 192.168.0.14:8000
> <VirtualHost 192.168.0.14:8000>
> ServerName example1.com
> WSGIScriptAlias / /var/code/drat/settings/example1/live.wsgi
> WSGIProcessGroup drat
> SetEnvIf X_FORWARDED_PROTO https HTTPS 1
> </VirtualHost>
> # example2.com
> Listen 192.168.0.14:8001
> <VirtualHost 192.168.0.14:8001>
> ServerName example2.com
> WSGIScriptAlias / /var/code/drat/settings/example2/live.wsgi
> WSGIProcessGroup drat
> SetEnvIf X_FORWARDED_PROTO https HTTPS 1
> </VirtualHost>
>
> The two websites use the same code, but the live.wsgi sets a different
> environment variable as the 'settings' module. There is no caching in
> the code.
>
> Sporadically, about 1 in 5000 requests, one seems to read the other's
> settings variables. At least, that's the only explanation I can think
> of. I'm wondering if this is possible, or perhaps even expected. I'm
> pretty sure they are in different python sub-interpreters because by
> default WSGIApplicationGroup is set to %{RESOURCE}. But I'm in fairly
> unfamiliar territory.
>
> Thanks for taking the time to read this, and please let me know if I
> can provide better information.
>
> Apache 2.2.9 prefork, mod_wsgi/2.3, happens in all 4 servers (this is
> a load balance group)
Can you explain better what happens for that 1 request in 5000?
When you say 'settings' module, do you mean you are using Django? Can
you post the WSGI script file being used.
Do you set any other environment variables, ie., assign to os.environ,
in WSGI script file, or know of any which are being set at request
time anywhere in your application code, or third party modules you may
use?
I'll explain better later when have a chance, but there are issues
with Python and multiple sub interpreters in respect of environment
variable leakage, but if the only os.environ variable being set was
DJANGO_SETTINGS_MODULE, it wouldn't usually present as a problem.
That said, I have heard a couple of times of strange mixing still
occurring whereby using distinct daemon processes for each instance
solved the problem.
If you have time, would like to try and dig deeper into this and try
and work out this time what might be happening. For some background
reading on environment variable leakage, look at:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Application_Environment_Variables
I'll explain later again though why this shouldn't be an issue for
DJANGO_SETTINGS_MODULE.
BTW, the 'SetEnvIf X_FORWARDED_PROTO https HTTPS 1' sounds like you
are fronting by another web server and trying to detect whether
fronting web server was using HTTPS. Yes/No? We were discussing that
recently for nginx in:
http://groups.google.com/group/modwsgi/browse_frm/thread/94f952720c878506?hl=en
I still have to post again to that thread and summarise it. Will be
doing that later.
Graham
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---