Hi 

Just out of curiosity, really.

I'm running mod_wsgi 3.2 under Apache/2.2.15 on RHEL 6.4, Apache is set to 
prefork and mod_wsgi is running in embedded mode. IOW, default config. Can 
provide more details if needed.

So I was asked about whether each request gets a clean python interpreter, 
to which I said "I'm not sure but I can find out".

So then I added some crummy debug code to my mod_wsgi script:


interface = Interface()

application = interface.wsgi

class Interface(object):
    "Interface is used to expose method calls."
    def __init__(self):
        p = PrintPid()
        self._lookup = dict()
        ....
    def wsgi(self, environment, start_response):
        ...

class PrintPid(object):
    def __init__(self):
        h = open('/tmp/apache_pids', 'a')
        h.write(str(os.getpid()))
        h.write('\n')
        h.close()

After doing a few dozen requests, as I expected, /tmp/apache_pids had about 
the same list of pids as I get from "ps -ef | grep httpd". 

However, I don't see any python processes running in between requests.

So, the question is, does that mean PrintPid only gets instantiated once 
per apache worker process? Could that then mean that state could persist 
between requests??

Also, does embedded mode mean the python interpreter can hide from 'ps'?

Any help appreciated.

James


-- 
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