[Zope-dev] Re: [Zope-DB] Bug in ZSQL method result caching?
Chris Withers
chris at simplistix.co.uk
Mon Apr 10 14:17:46 EDT 2006
Hi Dirk,
I'm CC'ing in zope-dev as more people there may care...
Dirk Datzert wrote:
> Hi Chris,
>
> you wrote on the ZOPE-DB mailing-list
> http://www.mail-archive.com/zope-db@zope.org/msg00417.html at Fri, 24
> Feb 2006 09:15:31 -0800.
>
> I have seen this KeyError after updating from Zope 2.7.5 to Zope 2.8.6
> last weekend about every 20 Minutes.
>
> Have you ever got a fix about this ?
Nope, never got a fix...
> I fixed it like this:
>
> ===========================================
>
> if len(cache) > max_cache / 2:
> keys=tcache.keys()
> keys.reverse()
> while keys and (len(keys) > max_cache or keys[-1] < t):
> key=keys[-1]
> q=tcache[key]
> del tcache[key]
> - if int(cache[q][0]) == key:
> + if cache.has_key(q) and int(cache[q][0]) == key:
> del cache[q]
> del keys[-1]
>
> ===========================================
>
> Maybe this is worth to do a bug entry on zope.org ?
Definitely. Would you mind adding one?
Is it possible to write tests for this code?
If not, would anyone mind if I applied this patch to the 2.8 and 2.9
branches along with the trunk?
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope-Dev
mailing list