[Zope3-dev] Intermittent failures in WeakRef doctest

Jim Fulton jim at zope.com
Mon Jan 26 09:27:57 EST 2004


I would ignore this for now.

I happen to be debugging this failure under ZODB 4.

Jim


Dave Harris wrote:
> A week ago, I reported intermittent failures of the WeakRef doctest.
> 
> (http://mail.zope.org/pipermail/zope3-dev/2004-January/009431.html)
> 
> I didn't get any advice on my testing process, so I set it aside for a 
> while. After all, I was overjoyed to get the unit tests running cleanly 
> under Windows XP.
> 
> But still, every now and then, the WeakRef failure pops up, spoiling my 
> perfect score. Today, I dug a little deeper and distilled the doctest from 
> wref.py into a looping script (see below.)
> 
> Under Windows XP, the failure rate is about 65%. That is, the dereference 
> returns None about 35% of the time and an empty list '[]' about 65% of the 
> time.
> 
> I'm still gathering information about the internal goings-on, and I'll pass 
> along what I find.
> 
> "What is my quest? I seek the fragile WeakRef!"
> Dave Harris
> 
> Here's the script:
> 
> # wref test based on wref.py doctest
> # 2004-01-24
> 
> import persistence.list
> from persistence.wref import WeakRef
> import zodb.tests.util
> 
> nones = 0
> lists = 0
> 
> for i in range(100):
>     ob = persistence.list.PersistentList()
>     ref = WeakRef(ob)
> 
>     db = zodb.tests.util.DB()
> 
>     conn1 = db.open()
>     r1 = conn1.root()
>     r1['ob'] = ob
>     r1['ref'] = ref
>     zodb.tests.util.commit()
> 
>     del r1['ob']
>     zodb.tests.util.commit()
>     zodb.tests.util.pack(db)
> 
>     conn3 = db.open()
>     r3 = conn3.root()
> 
>     if r3['ref']() == None:
>         nones += 1
>     else:
>         lists += 1
> 
>     db.close()
> 
> print "ref() == None %s times, ref() == [] %s times" % (nones, lists) 
> 
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-dev


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list