On Wed, Jan 12, 2011 at 02:34:13PM +0100, Godefroid Chapelle wrote:
We have been experiencing some ConnectionStateError in a Zope 2 based application.
Looking for info on the web makes me almost 100% sure that we have a bug in our application layer.
I understand that I should look for persistent objects stored in module or class level variables (which imply shared by threads and thus connections). Do not hesitate to tell me if this is a wrong explanation of the potential cause of ConnectionStateError.
However, I wonder if some of you could give debugging techniques outside reviewing the code.
I would be inclined to use pdb, get hold of the offending object, and then use http://mg.pov.lt/objgraph/ to find which global variable refers to it. (It could be a case of "if all you've got is a hammer", since objgraph is still shiny in my mind.)
I also wonder what was the reason to deprecate ``zope.thread``.
Because it was folded into the standard library in Python 2.4. zope.thread.local() became threading.local()
I see it was used by ``zope.component`` to hold thread-safe siteinfo. Could a too frequent usage of getSite lead to ConnectionStateError ? I think that it is not the case but I prefer to ask.
Unlikely. Marius Gedminas -- http://pov.lt/ -- Zope 3/BlueBream consulting and development