Hi dharana,

I've been away for a few days, but should have some time to mess around with this today.


dharana wrote:
More info:

It just happens with some classes. Some work and some won't, and I don't yet know why.

Do you ever see segfaults if you only saving strings in your session, rather than objects? I have the feeling that I've seen mention of problems trying to pickle some objects. (Both DbmSession and FileSession create a pickle to store the data). I'm not sure if this was in the docs or on the mailing list. I'll dig around to see what I can find.

Do you see the same segfault if you use DbmSession? If not then that would rule out a pickle problem.

Some info:
In my webapp when user logs in I save a User object (subclassing class Storable). And then I redirect. Works ok, no problem.

Then, in another page I try to save a Website object (subclassing from both Storable and Website). It segfaults.

Could it be something related to multiple inheritance? In my ignorance I thought so, but then when I try to save a Dbobj class just for testing purposes it also crashes. Dbobj inherits from object directly and has some methods defined as classmethod.

My question is: how does mod_python knows where to look for a class while trying to retrieve it? Imagine I start a session in namespace a and then in namespace b I save a class instance which is only known to namespace b. What happens when namespace a tries to save the session or when it tries to load it again? How does it knows where to look for the class instance only known to namespace b?

Interesting question. I'll need to refresh myself on the pickling mechanism.

Maybe the problem lies there?

Anyway I will save the object_id in the session instead of the class instance and I will load the object from it.


I'm really sorry for the spam. My head starts spinning really fast when I see segfaults.

Hey, this is not spam. :) And segfaults make my head spin too.

Regards,
Jim


dharana wrote:

This is driving me crazy. I'm finding it hard to make a simple testcase.

I use a custom handler and somewhere in the code I do this:

-- [snip] -------------------------------------------------------------
from mypackage.mysubpackage.mysubsubpackage import db

def run(req):
    req.sess['foo'] = object
    # req.sess['foo'] = db
    req.sess.save()
    return

# I redirect the user another path with util.redirect and then the segfault
# happens
----------------------------------------------------------------------


The moment I try to assign my own classes (ie: assigning db instead of object I must manually delete the pysid cookie to stop the segfaults.

It seems as if mp corrupts or somehow leaves in an usable state the session after trying to save my objects. I tried with different objects and it happens with all of them. Does anyone knows how I can retrieve more info from the segfault? I don't like segfaults :( they don't tell why they don't like you.

dharana wrote:




Reply via email to