[Zope-dev] ConnectionStateError

Godefroid Chapelle gotcha at bubblenet.be
Wed Jan 12 12:00:56 EST 2011


Le 12/01/11 17:06, Hanno Schlichting a écrit :
> On Wed, Jan 12, 2011 at 2:34 PM, Godefroid Chapelle<gotcha at bubblenet.be>  wrote:
>> 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.

Thanks for help from anyone.

Once debugged, I'll blog how I found the bug.

> Do you get the classic: "Shouldn't load state for %s when the
> connection is closed" or one of the "The database connection is
> closed" errors?
>
> In the first case you get the p_oid, which you can load from the
> database to give you some clue on what class it is.

I had no clue that the number in the error message was the p_oid. I 
could have found out by reading the code.

Nevertheless, I propose to make the error message more self-explanatory.

> Typical problems include using plone.memoize decorators on things
> without knowing where exactly the cache is stored or as someone else
> noted registering persistent objects in the global site manager
> instead of the local one. The global one is of course just a module
> global data structure in the end.
>
> Hanno

-- 
Godefroid Chapelle (aka __gotcha) http://bubblenet.be



More information about the Zope-Dev mailing list