[mod_python] MemorySession and httpd processes

Graham Dumpleton grahamd at dscpl.com.au
Sat May 6 20:04:24 EDT 2006

On 06/05/2006, at 9:32 AM, Alexis Marrero wrote:

> Is there anyway that I can use mod_python.Session.MemorySession  
> through the different httpd processes? I guess that the answer is  
> no, but I wanted to check.
> I have a process that post data multiple times, one session.
> The problems that I'm having is that httpd instantiate multiple  
> servers by the ServerLimit in hte worker.c module.  Every time  
> apache switches process for handling one of the requests for the  
> requests mod_python believe that the session is not longer valid  
> and creates a new one.
> I had to change my httpd.conf to look like this:
> ###### httpd conf
> # worker MPM
> # StartServers: initial number of server processes to start
> # MaxClients: maximum number of simultaneous client connections
> # MinSpareThreads: minimum number of worker threads which are kept  
> spare
> # MaxSpareThreads: maximum number of worker threads which are kept  
> spare
> # ThreadsPerChild: constant number of worker threads in each server  
> process
> # MaxRequestsPerChild: maximum number of requests a server process  
> serves
> <IfModule worker.c>
> ServerLimit          1
> StartServers         1
> MaxClients          25
> MinSpareThreads     25
> MaxSpareThreads     75
> ThreadsPerChild     25
> MaxRequestsPerChild  0
> </IfModule>
> #######
> In order to force apache to use the same process so the session can  
> be share my multiple threads under the same process.
> But as you can see this limits my number of Process to 1!
> Is there any other more efficient way.
> Note that the one of the objects that I need to save in the session  
> CANNOT be pickled.

What is the object you are trying to pickle and what error is it  
giving back indicating
that it can't be pickled? We may be able to suggest a better way of  
managing you
data to avoid the restriction.

FWIW, you might also ensure you read:


This talks about some of the pickling issues with session objects.


More information about the Mod_python mailing list