Re: PythonSessionOption - a new apache directive for session configuration

2005-06-12 Thread Nicolas Lehuen
Hi Jim, Why not have a single 'PythonSessionCreate' option which contains the line of code that should be evaled to create the session ? Example : PythonSessionCreate "Session.FileSession(session_directory='/var/lib/mod_python/sess',timeout=14400,lock=1)" The cost of eval could be brought down

Re: session handling - the next generation

2005-06-12 Thread Nicolas Lehuen
Hi Jim, Have you added the corresponding code in request_tp_clear and request_tp_traverse ? I think you can check-in your code, since the debate about import looks like it is going to take som time before the next release... Regards, Nicolas 2005/6/12, Jim Gallacher <[EMAIL PROTECTED]>: > Nicol

Re: session handling - the next generation

2005-06-12 Thread Jim Gallacher
Nicolas Lehuen wrote: Hi Jim, After a few checks (unittest + load testing), I've checked in my modifications ; you might want to update and merge it with your code. I'm still getting a memory leak with the merged code. Should I commit my changes anyway, or maybe we could create new svn branch

PythonSessionOption - a new apache directive for session configuration

2005-06-12 Thread Jim Gallacher
I've created a new apache directive called PythonSessionOption. This would be used to configure session handling in the apache config file. This data is accessed with a new request method, req.get_session_options(). Although we could use the PythonOption directive instead of creating a new one

Re: session handling - the next generation

2005-06-12 Thread Nicolas Lehuen
Hi Jim, After a few checks (unittest + load testing), I've checked in my modifications ; you might want to update and merge it with your code. Regards, Nicolas 2005/6/12, Jim Gallacher <[EMAIL PROTECTED]>: > Nicolas Lehuen wrote: > > You should cast self to a requestobject* : > > That worked. R

Re: session handling - the next generation

2005-06-12 Thread Jim Gallacher
Nicolas Lehuen wrote: You should cast self to a requestobject* : That worked. Running some tests. Jim ((requestobject*)self)->session Anyway, I'm currently rewriting the whole request_tp_traverse / request_tp_clear / request_tp_clear functions like this : static void request_tp_dealloc(re

Re: session handling - the next generation

2005-06-12 Thread Nicolas Lehuen
You should cast self to a requestobject* : ((requestobject*)self)->session Anyway, I'm currently rewriting the whole request_tp_traverse / request_tp_clear / request_tp_clear functions like this : static void request_tp_dealloc(requestobject *self) { // de-register the object from the GC

Re: session handling - the next generation

2005-06-12 Thread Nicolas Lehuen
I'm re-reading the comment I wrote when I implemented tp_traverse : // only traverse its dictionary since other fields defined in request_rec_mbrs with type T_OBJECT // cannot be the source of memory leaks (unless you really want it) Turns out that we should at least traverse the next and prev in

Re: session handling - the next generation

2005-06-12 Thread Nicolas Lehuen
Duh, I get it. If you add a member to the request object, and this member is not referenced in the request object's dictionary, then you have to add a special case for it in the tp_traverse handler. In requestobject.c : /** ** request_tp_traverse ** *Traversal of the request object */ stat

Re: session handling - the next generation

2005-06-12 Thread Nicolas Lehuen
Hi Jim, How where you creating the session object in requestobject.c ? If you were using PythonObject_New, then this may explain the memory leak. Objects that must be managed by the garbage collector have to be created with PyObject_GC_New. Regards, Nicolas 2005/6/12, Jim Gallacher <[EMAIL PROT

Re: session handling - the next generation

2005-06-12 Thread Jim Gallacher
Replying to my own email, It looks like there was problem with a circular reference in req->session->req. This resulted in a memory leak which I had mis-interpreted as a reference count problem in req_get_session. As a result, I was not doing a Py_INCREF(self->session) in req_get_session().