[Python-Dev] [Python-checkins] Python Regression Test Failures refleak (1)
Tim Peters
tim.peters at gmail.com
Wed Jun 7 03:02:55 CEST 2006
[Tim, gets different results across whole runs of
python_d ../Lib/test/regrtest.py -R 2:40: test_filecmp test_exceptions
]
I think I found the cause for test_filecmp giving different results
across runs, at least on Windows. It appears to be due to this test
line:
self.failUnless(d.same_files == ['file'])
and you _still_ think I'm nuts ;-) The skinny is that
d = filecmp.dircmp(self.dir, self.dir_same)
and filecmp contains a module-level _cache with a funky scheme for
avoiding file comparisons if various os.stat() values haven't changed.
But st_mtime on Windows doesn't necessarily change when a file is
modified -- it has limited resolution (2 seconds on FAT32, and I'm
having a hard time finding a believable answer for NTFS (which I'm
using)).
In any case, filecmp._cache _usually_ doesn't change during a run, but
sometimes it sprouts a new entry, like
{('c:\\docume~1\\owner\\locals~1\\temp\\dir\\file',
'c:\\docume~1\\owner\\locals~1\\temp\\dir-same\\file'):
((32768, 27L, 1149640843.78125),
(32768, 27L, 1149640843.796875),
True)
}
and then that shows up as a small "leak".
That's easily repaired, and after doing so I haven't seen test_filecmp
report a leak again.
test_exceptions is a different story. My first 12 post-fix runs of:
python_d ..\Lib\test\regrtest.py -R2:40: test_filecmp test_exceptions
gave leak-free:
test_filecmp
beginning 42 repetitions
123456789012345678901234567890123456789012
..........................................
test_exceptions
beginning 42 repetitions
123456789012345678901234567890123456789012
..........................................
All 2 tests OK.
[25878 refs]
output, but the 13th was unlucky:
test_filecmp
beginning 42 repetitions
123456789012345678901234567890123456789012
..........................................
test_exceptions
beginning 42 repetitions
123456789012345678901234567890123456789012
..........................................
test_exceptions leaked [0, 203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0] references
All 2 tests OK.
[25883 refs]
Running test_filecmp too isn't necessary for me to see this --
test_exceptions can be run by itself, although it typically takes me
about 15 runs before "a leak" is reported. When a leak is reported,
it's always 203, and there's only one of those in the leak vector, but
I've seen it at index positions 0, 1, 2, and 3 (i.e., it moves around;
it was at index 1 in the output above).
Anyone bored enough to report what happens on Linux? Anyone remember
adding a goofy cache to exception internals?
a-suitable-msg-for-6/6/6-ly y'rs - tim
More information about the Python-Dev
mailing list