[Zope-DB] 2Gurus: DB layer and ZODB timeouts

kapil thangavelu kvthan@wm.edu
Sat, 21 Dec 2002 04:43:58 -0800


On Thursday 19 December 2002 11:17 am, Bo M. Maryniuck wrote:
> On Thursday 19 December 2002 06:34, kapil thangavelu wrote:
> > say that ;-)... relating to the new zodb cache impl toby did thats in
> > 2.6. what exactly are you doing and how are you doing it? are you holding
> > on to connections for more than the length of one request, how are you
> > creating them, etc.
>
> I create a connection with unique ID for each logged in user. Therefore
> user should run only one thread of its unique connect (at least I guess
> Zope will not clone it somehow). The only think I found is to  delete  a
> self. v database connection on manage close connection() in
> ../Shared/DC/..../Connection.py and it even works as I expect. But I'm not
> sure it is right way.

that really doesn't answer the question (which was poorly phrased). basically 
i'm wondering how you create these connections, mainly to determine if your 
adding them to the zodb or storing them soley in memory. 

so say your adding these connections to some folder with a python script and 
then executing some zsql methods against them and then deleting them. doing 
this is not a good thing, as in addition to oracle connection overhead, your 
causing extraneous writes to the zodb (for the container and the da) because 
those connections will be added.. although that does represent an interesting 
case if your trying to do a delete in the same txn, as the da has already 
been registered with the txn for commital to the zodb, i digress. from the 
description of your problem it sounds like somehow these db connections (the 
ones created through the python scripts) are being persisted for more than 
the length of one request. which is why i think the cache implemenation 
change between 2.6 and 2.5 could affect (though thats guess work). if your 
using zsql methods to execute queries, theres not much you can do, although 
if you were doing so, i'm not sure how your binding the zsql method to the 
da. there are lots of unanswered questions...

if your using unrestricted python, there are lots of options, from creating 
connections in external methods to a product which does all your queries... 
if you need to stick to your zmi based zsql methods... you could a proxy 
object that looks enough like a da, but allows you to return a da based on 
variable parameters, and you'd also need to subclass zsql methods to take 
either take their connection object or connection id as a variable... lots of 
options..

you mentioned you had a temporary solution of delete _v_database_connection, 
don't do that. its possible bad things could happen, although matt k. would 
know better. the better thing to do is to manage_close_connection on the da.

-k