Detmar Meurers
dm at ling.ohio-state.edu
Tue Mar 27 20:29:09 EST 2007
Hi Graham, Thanks for the very quick reply. The page showing the problem actually is using the publisher handler (so no special exception handling etc.) I tried the FileSession and the problem occurs there too - and I'm not doing any calling of unlock(). I am calling req.session.save() - one question about that though: Can it possibly cause problems when calling the save() several times when handling one request? I'll do some more thorough logging and will report if I find out what's causing this. Best, Detmar On Wed, Mar 28, 2007 at 09:23:03AM +1000, Graham Dumpleton wrote: Only suggestion is to doubly make sure that you are doing the required req.session.save() before the request actually returns. If you are using: raise apache.SERVER_RETURN, apache.OK or similar mechanisms whereby you are using exceptions to jump back up calling stack in non error conditions, ensure you have try/finally block where save is being done in finally block. You might log a message at every point you do a save to ensure it is always happening as you expect. You might also try FileSession instead of DBMSession. See documentation for PythonOption to override which storage mechanism is used. This will indicate whether it is just somehow DBM database or all storage mechanisms. BTW, you aren't every performing an unlock() of session at any point are you? Graham On 28/03/07, Detmar Meurers <dm at ling.ohio-state.edu> wrote: >Hi, > >I'm experiencing some strange behavior with mod_python sessions >(using the mod_python Session module, which in my setup seems to use >dbm). I'm using Apache/2.2.0 (Unix) mod_ssl/2.2.0 OpenSSL/0.9.8b DAV/2 >mod_python/3.3.1 Python/2.4.2 on an Intel Mac (mpm-prefork). > >I can store information in the session variable, which I've stored >under req.session, just fine, e.g. > >req.session['rememberme'] = 'foobar' > >but for some reason in situations I haven't been able to pin down >yet, when I store more complex information, e.g. a dictionary such as > >req.session['rememberme'] = {'name' : 'john', > 'address': {'road': 'high st', > 'nr': 22}} > >then often times part of that dictionary value has disappeared when >I look it up again in a later page, e.g. I get a dictionary >containing only the key 'name' instead of both keys. I unfortunately >haven't been able to pin it down further yet (apart from observing >that it seems to appear primarily (?) in situations involving AJAX >POST calls). > >Has someone has seen something like this before? Any hints on what >can cause the disappearance of part of a session variable value? Or >perhaps it for some reason doesnn't read in the session variable >properly in some of the mod_python processes running? Any hints >would be much appreciated! > >Best, >Detmar > >-- >Detmar Meurers, Associate Professor, Dept. of Linguistics, OSU >201a Oxley Hall, 1712 Neil Avenue, Columbus OH 43210-1298, USA >http://ling.osu.edu/~dm/ GnuPG key on web page >_______________________________________________ >Mod_python mailing list >Mod_python at modpython.org >http://mailman.modpython.org/mailman/listinfo/mod_python > -- -- Detmar Meurers, Associate Professor, Dept. of Linguistics, OSU 201a Oxley Hall, 1712 Neil Avenue, Columbus OH 43210-1298, USA http://ling.osu.edu/~dm/ GnuPG key on web page
|