[Python-checkins] Python Regression Test Failures refleak (2)
Neal Norwitz
nnorwitz at gmail.com
Thu Jun 8 07:41:15 CEST 2006
On 6/7/06, Neal Norwitz <neal at metaslash.com> wrote:
> test_socket leaked [1, 1, 1] references
> test_threadedtempfile leaked [-83, 0, 0] references
I fixed the leak in test_socket and I have an outstanding change that
I think will fix the false positive wrt to threadedtempfile (really
threading module). We'll see if it helps. Before arriving at this
patch, I printed the diff between the original values and the current
values (after running the test) and there was a diff sometimes. These
diffs seem to coincide with reported leaks.
n
--
Index: Lib/test/test_threadedtempfile.py
===================================================================
--- Lib/test/test_threadedtempfile.py (revision 46734)
+++ Lib/test/test_threadedtempfile.py (working copy)
@@ -48,6 +48,8 @@
def test_main():
threads = []
+ num_active = len(threading._active)
+ num_limbo = len(threading._limbo)
print "Creating"
for i in range(NUM_THREADS):
@@ -72,7 +74,18 @@
if errors:
raise TestFailed(msg)
+ # Try to prevent refleaks reported from regrtest.py -R.
+ import time
+ _MAX_COUNT = 10
+ count = 0
+ while len(threading._active) != num_active and count < _MAX_COUNT:
+ time.sleep(0.1)
+
+ count = 0
+ while len(threading._limbo) != num_limbo and count < _MAX_COUNT:
+ time.sleep(0.1)
+
if __name__ == "__main__":
import sys, getopt
opts, args = getopt.getopt(sys.argv[1:], "t:f:")
More information about the Python-checkins
mailing list