[Python-checkins] Python Regression Test Failures refleak (1)

Neal Norwitz nnorwitz at gmail.com
Sun Jun 4 19:37:23 CEST 2006


On 6/4/06, Tim Peters <tim.peters at gmail.com> wrote:
> [Neal Norwitz]
> >> test_exceptions leaked [0, 2, 0] references
> >> test_filecmp leaked [13, 0, 0] references
>
> [Richard Jones]
> > What's producing this output?
>
> While I've never run it, I believe it's produced by Misc/build.sh.

Correct.  It's run every 12 hours.  Sometimes it hangs due to
test_logging or one of the various socket tests.

> > On what OS?
>
> Windows 3.1 with Neal's cool hack to implement the Bourne shell as a
> Windows device driver ;-)

Oooooh, so close.  :-)  It's the x86 buildbot (gentoo).

> > I'd like to try to find that leak in exceptions if possible.
>
> There probably isn't a leak.

I'm 99.44% sure there's no leak.

> Does that make any sense?  Not to me -- I don't know of a clear reason
> other than wild loads/stores for why such runs should ever differ.

The problem generally has to do with modules cacheing things.  The way
to cleanup the cache and eliminate these false positives is in
regrtest.py, see cleanup.  To give you an idea of how much needs to be
cleaned up currently, I pasting the code:

                def cleanup():
                    _path_created.clear()
                    warnings.filters[:] = fs
                    gc.collect()
                    re.purge()
                    _strptime._regex_cache.clear()
                    urlparse.clear_cache()
                    urllib.urlcleanup()
                    urllib2.install_opener(None)
                    copy_reg.dispatch_table.clear()
                    copy_reg.dispatch_table.update(ps)
                    sys.path_importer_cache.clear()
                    sys.path_importer_cache.update(pic)
                    dircache.reset()
                    linecache.clearcache()
                    mimetypes._default_mime_types()
                    struct._cache.clear()
                    doctest.master = None

It's possible that gc.collect() should also be called at the end of
it.  On the box this is run on, I added 2 gc.collect() calls at the
end of cleanup, just to be safe.

So to fix this problem, you'd have to find where those refs are being
stuck and clear them out somehow.

n


More information about the Python-checkins mailing list