[CDBI] Use with mod_perl caching question

Rolf Schaufelberger rs at plusw.de
Thu Dec 13 17:51:02 GMT 2007


On Thursday 13 December 2007 18:20:01 Perrin Harkins wrote:
> On Dec 13, 2007 11:50 AM, Berg, Eric <eric.berg at lehman.com> wrote:
> > The problem that I'm having is that my cdbi mods in some of the apache
> > instances are returning stale data in response to these requests.
> If you're using InnoDB, check your isolation level as described here:
> http://perl.apache.org/docs/1.0/guide/databases.html#Transactions_Not_Commi
> If not try turning off the object index:
> http://wiki.class-dbi.com/wiki/Common_problems#Old_data_due_to_object_index
> - Perrin

I had a similar problem recently with CDBI an my mod_perl app. I had a page  
with lots of dynamically created images on it, some images depending on the 
content of my session. The session is written (to Postgres) with "Select for 
update" (Apache::Session) , yet, since CDBI recommends AutoCommit=>1 this is 
completely ineffective. Normally this doesn't matter, but here a lot of 
parallel requests led to some requests reading an "old" state of the session 
or even overwriting the state of the "main" request (SessionAlwaysWrite=>1 ).
I think the same problem can happen with any data written to the database when 
you have asynchronous AJAX requests. 

Rolf Schaufelberger

More information about the ClassDBI mailing list