A few things can be happening.

1. You are in fact using daemon mode but you are changing the WSGI script file 
between requests, which will cause mod_wsgi to kill and restart the daemon 
process and so reload your code.

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

2. You are in fact using daemon mode and you have set maximum-requests, 
inactivity-timeout or some other option which would cause the daemon process to 
be killed and restarted based on some condition.

3. You have not got your configuration correct and are not actually delegating 
the WSGI application to run in the daemon process group. For example,e missing 
WSGIProcessGroup directive to match WSGIDaemonProcess, and so you are running 
in multiprocess embedded mode configuration instead.

http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Embedded_Or_Daemon_Mode

4. You have not got your configuration correct and have used a wildcard in 
conjunction with WSGIScriptAlias which is triggering a case where every 
distinct URL is using a different sub interpreter.

http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Sub_Interpreter_Being_Used

So I would suggest you run the test to see whether you are using daemon mode or 
not and also post your configuration here so can verify that it has been done 
correctly.

Graham

On 17/06/2014, at 6:41 AM, [email protected] wrote:

> Hello.
> 
> I am trying to share data in memory between invocations of my request handler.
> I assume that a module gets imported only once per lifetime of the 
> application and mod_wsgi does not re-import the module for next request.
> 
> So basically, I am writing something like this:
> 
> class X:
>    ...
> 
> XX = X()
> 
> def application(environ, start_response):
>     ...
>     XX.method()
>     ...
> 
> and my assumption is that XX and its attributes survive unchanged between 
> requests.
> 
> I have threads=1 and omit "processes" argument, which is equivalent to 
> processes=1
> 
> I found that this is not always true. What I am seeing is that the module 
> gets re-imported pretty consistently if I access my server from some other 
> client.
> 
> In other words, as long as I access my server from the same browser or repeat 
> the same wget command from the same computer, I reach the same XX object. But 
> if I switch to certain other way to access the page, I see that the module is 
> re-imported and the object is re-created. 
> 
> Can someone explain this please ?
> 
> Thanks.
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to