[Zope] Re: UnpickleableError: Cannot
pickle<type'thread.lock'>objects
Dylan Jay
gmane at dylanjay.com
Wed Jun 15 02:35:28 EDT 2005
"Dylan Jay" <gmane at dylanjay.com> wrote in message
news:d8ogk5$27c$1 at sea.gmane.org...
>I think I've tracked it down to a RamCacheManager inside a volitile
>variable. But I thought volitile variables we'ren't stored? Am I doing
>something strange with my heirachy that is abusing the ZODB? The heirachy
>is
> object.<Map>[Cacheable] And the Cacheable has _v_ZCacheable_cache =
> RamCacheManager. I believe the RamCacheManager has locks in it.
I think I've tracked down the problem. Cacheable did not inherit from
Persistent. I was infact using a super class of Cacheable called
NamedCacheable which inherited Acquisition.Implicit which I'd thought was
enough (a long time ago when I wrote it).
Just for the record, how I tracked this down was by using dumps. In pdb I
did
from pickle import dumps
pp state['attributename']
until I found the parts of the state that raised errors.
>
>
>> "Dieter Maurer" <dieter at handshake.de> wrote in message
>> news:17071.4574.893818.528219 at gargle.gargle.HOWL...
>>> Dylan Jay wrote at 2005-6-14 17:45 +1000:
>>>> ...
>>>>356, in _commit_objects
>>>> jar.commit(o, self)
>>>> File "C:\Program
>>>> Files\Zope-2.7.5-final\lib\python\ZODB\Connection.py",
>>>>line 4
>>>>52, in commit
>>>> dump(state)
>>>>UnpickleableError: Cannot pickle <type 'thread.lock'> objects
>>>
>>> I would catch the error and enter a debugger to analyse the "o" above.
>>>
>>> With "pdb" (the Python Debugger, part of Python),
>>> this could look like:
>>>
>>> try: dump(state)
>>> except: import pdb; pdb.set_trace()
>>
>> Good suggestion (I did try to get debugging working in WingIDE and Boa
>> but your way worked best in the end).
>> Unfortunatly I'm still none the wiser.
>> I know which object it is and I've looked at its state (below). I've
>> looked at the OOBTree and made sure it contains nothing that has a lock
>> in it. I can look at sys.exc_info[1].args which is a lock object but what
>> I really need to do is work out where this lock object is and why its
>> entangled with my transaction. Any suggestions?
>>
>> {'__ac_local_roles__': {'djay': ['Owner']},
>> '_cacheables': {'constructReviewer': <NamedCacheable instance at
>> 0409A8D0>,
>> 'findNeighbors': <NamedCacheable instance at 0409A8C0>},
>> '_hasBeenTrained': 0,
>> 'filterByMovies': 0,
>> 'filterByPeople': 0,
>> 'filterByVotes': 0,
>> 'hashMoviesToUse': None,
>> 'hashPeopleToUse': None,
>> 'hoods': <OOBTree object at 0x041B5368>,
>> 'id': 'predictor',
>> 'keepInMemory': 0,
>> 'moviesToUse': None,
>> 'neighborhoodSize': 30,
>> 'overlapPenalty': 50,
>> 'peopleToUse': None,
>> 'reviewers': None,
>> 'title': '',
>> 'votesToUse': None}
>>
>>
>>
>> _______________________________________________
>> Zope maillist - Zope at zope.org
>> http://mail.zope.org/mailman/listinfo/zope
>> ** No cross posts or HTML encoding! **
>> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
>> http://mail.zope.org/mailman/listinfo/zope-dev )
>>
>
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
More information about the Zope
mailing list