[Zope-dev] Question about _v_ attributes and database connections
Marco Bizzarri
emmebi at icube.it
Fri Mar 5 10:05:24 EST 2004
On Fri, Mar 05, 2004 at 11:16:37AM +0000, Chris Withers wrote:
> Hi Marco,
Hi.
> Marco Bizzarri wrote:
>
> >We're trying to tackle a problem in hanging connections in ZPsycopg.
>
> Hehe, I fixed this for ZOracleDA a couple of months ago. You may want to
> look at the thread pool code in there to see how I did it, gimme a nod if
> you need a URL (it's on a CVS branch in cvs.zope.org)
I took a look at that, the connections.CTM, and the other. The simple
question is if this is a known problem with *ALL* db adapters, and, in
this case, it could be possible to devise a general solution, or if this
has something to do with psycopg.
I've a scenario where I can produce hanging connections in ZPsycopg:
1) use page with sql methods
2) refresh a product
3) repeat 1)
4) refresh a product
if you have 4 threads, you should have now 5 connections. Obviously here
there is something wrong with the management of _v_ attributes, in
particular the _v_database_connection in the DA.py. The psycopg code is
quite similar to the basic DA.py code, so I was looking for other ways
of approaching the problem.
> >However, I would like to have some information about the functioning of
> >the _v_ attributes, and the cache management. In particular:
> >
> >1) where is the code which handles the _v_ attributes (I like to look at
> >the source code, you know ;))
>
> Never bothered finding it, the sematics are pretty well documented.
Yes, actually.
> >2) where is the code which handles the caching of the objects?
>
> The ZODB cache. It's big and complicated, trust me, you DON'T need to go
> there...
:(
> >3) is it possible to disable caching of some object?
>
> No. The fact that you want to means you're mis-using _v_ attributes ;-)
My feeling was that the hanging connection problem was related to the
cache... so the question (I'm not using _v_ attributes in any particular
way)
> >4) when an _v_ attribute is removed, what code of the object/attribute
> >itself is called?
>
> None. I believe it gets lost at the object is ghosted.
>
> >If possible, please answer also directly to me (I'm not on this list).
>
> Are you maintaining ZPsychopg? If not, the maintainers might be able to
> help...
No, actually we've a db application which makes a lot of use of zpsycopg
for insert/updates, not only for select, and we stumbled on this
problem. We're working with Federico Di Gregorio (psycopg mantainer) in
order to solve the problem.
> cheers,
>
> Chris - who learnt a whole lot more about ZODB and ZODB caching when
> solving this kind of problem in ZOracleDA ;-)
I suspect I will have to learn something in the hard way too :)
> --
> Simplistix - Content Management, Zope & Python Consulting
> - http://www.simplistix.co.uk
Thanks for your help
Regards
Marco
--
Marco Bizzarri - Amministratore Delegato - Icube S.r.l.
Sede: Via Ridolfi 15 - 56124 Pisa (PI), Italia
E-mail: m.bizzarri at icube.it WWW: www.icube.it
Tel: (+39) 050 97 02 07 Fax: (+39) 050 31 36 588
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20040305/33a3f3d0/attachment.bin
More information about the Zope-Dev
mailing list