[pypy-svn] r75102 - pypy/benchmarks/own/twisted
arigo at codespeak.net
arigo at codespeak.net
Fri Jun 4 13:09:06 CEST 2010
Author: arigo
Date: Fri Jun 4 13:09:05 2010
New Revision: 75102
Modified:
pypy/benchmarks/own/twisted/benchlib.py
Log:
Add a sleep of 90 seconds at the end of any twisted benchmark
that creates a lot of connections. This should solve the issues
like DNS errors just afterwards, by giving the system enough time
to purge the mess of local TCP connections in the TIME_WAIT state.
Modified: pypy/benchmarks/own/twisted/benchlib.py
==============================================================================
--- pypy/benchmarks/own/twisted/benchlib.py (original)
+++ pypy/benchmarks/own/twisted/benchlib.py Fri Jun 4 13:09:05 2010
@@ -80,6 +80,7 @@
d.addErrback(log.err)
reactor.callWhenRunning(d.addBoth, lambda ign: reactor.stop())
reactor.run()
+ sleep_to_purge_connexions()
sys.exit(failure)
def multidriver(*f):
@@ -92,9 +93,21 @@
reactor.stop()
reactor.callWhenRunning(work)
reactor.run()
+ sleep_to_purge_connexions()
_interface = 1
def rotate_local_intf():
global _interface
_interface = _interface % 254 + 1
return '127.0.0.%d' % (_interface,)
+
+def sleep_to_purge_connexions():
+ # For tests that do a lot of TCP connexions, we sleep a bit more than
+ # 1 minute at the end. This makes sure that the sockets have time to
+ # get out of the TIME_WAIT state before we do anything more.
+ global _interface
+ if _interface != 1:
+ print >> sys.stderr, "sleeping 90 seconds..."
+ import time
+ time.sleep(90)
+ _interface = 1
More information about the Pypy-commit
mailing list