Re: ConnectionStateError

Marius Gedminas <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <20110112142259.GB14229@platonas>
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

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk0tuUMACgkQkVdEXeem14/gFQCcDwlgqEXyM1pf8JdGE93smwCe
6akAn1oWWLgV6DD0h34QDqwu4eiuskux
=oDW/
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.