[Zope] Class instances changing address?
Jeff Gentry
jgentry at jimmy.harvard.edu
Thu Jan 19 16:55:58 EST 2006
Hello ...
I'm running Zope 2.7.3 w/ python 2.4.1. I'm in the process of developing
a FS based product as a primary class w/ many sub-classes. I've been
experiencing a problem which I thought I had completely nixed but
apparently only partly so and now am out of ideas as to what might be the
source of the problem.
As background, the primary class (A) maintains a handle to an instance of
another class (B) which handles interaction w/ a psycopg db
controller. Class A also will instantiate several instances of Class C
and as part of the construction will pass it the handle to class B. So in
summary, A has a B and has 1:n C's, and C has a reference to B. A & B
have physical representations in the ZMI, while instances of C are
'virtual'.
What is happening at times is that all of a sudden any call from C to B
(ie C is accessing the DB) will result in Zope reporting that it could not
find the psycopg controller, and indeed when this happens, any call
through B via C will show that B can not find any DB controllers (using
SQLConnectionIDs()). When I looked a bit closer, I had C's instance of B
do a 'print instanceOfB' before calling out to B, which looked like this
in the console:
<B instance at 2a9d564da0>
What I found was at the moment that things stopped working, the address of
the instance was changed, which explains a lot. However, I can not figure
out why this would happen - as far as I can tell the B instance is not
being reassigned in any capacity in my code. Also, this seems to happen a
bit nondeterministically (although I'm sure it isn't really) in that the
same set of operations will not always have the same result here - it
might cause the above switch/failure in one run through but not the next 3
times.
I wish I could post some relevent code but the code base but given that
I'm not at all sure what section of the code might be causing this and the
code base is several thousand lines long, that'sn ot really possible :(
What I was hoping was that people might have some ideas as to what I might
be doing wrong here (and admittedly I tought myself Zope & Python mostly
from other Zope products and trial & error so there might be some key
issue that I'm totally missing).
Thanks in advance
Jeff
More information about the Zope
mailing list