[Zodb-checkins] CVS: ZODB4/src/zodb/zeo/tests - forker.py:1.7
zeoserver.py:1.10
Jeremy Hylton
jeremy at zope.com
Tue Jun 24 19:25:24 EDT 2003
Update of /cvs-repository/ZODB4/src/zodb/zeo/tests
In directory cvs.zope.org:/tmp/cvs-serv9899/src/zodb/zeo/tests
Modified Files:
forker.py zeoserver.py
Log Message:
Fix occasional connect errors in Berkeley/ZEO tests.
Sometimes Berkeley can take a really long time to open and initialize
the storage. Make sure forker waits long enough before giving up.
Add a hack to test.py and zeoserver.py to pass the location of log.ini
to spawned processes. I was in a hurry and couldn't think of a better
way.
=== ZODB4/src/zodb/zeo/tests/forker.py 1.6 => 1.7 ===
--- ZODB4/src/zodb/zeo/tests/forker.py:1.6 Thu Jun 19 17:41:07 2003
+++ ZODB4/src/zodb/zeo/tests/forker.py Tue Jun 24 18:25:23 2003
@@ -83,31 +83,38 @@
if script.endswith('.pyc'):
script = script[:-1]
+ logger = logging.getLogger("forker")
+
# Create a list of arguments, which we'll tuplify below
qa = _quote_arg
args = [qa(sys.executable), qa(script), '-C', qa(tmpfile)]
if keep:
args.append("-k")
d = os.environ.copy()
- d['PYTHONPATH'] = os.pathsep.join(sys.path)
+ d["PYTHONPATH"] = os.pathsep.join(sys.path)
+ logini = os.getenv("LOGINI")
+ if logini:
+ d["LOGINI"] = logini
pid = os.spawnve(os.P_NOWAIT, sys.executable, tuple(args), d)
+ logger.debug("spawned %s %s: %s", sys.executable, " ".join(args), pid)
adminaddr = ('localhost', port + 1)
- logger = logging.getLogger("forker")
- # We need to wait until the server starts, but not forever
- for i in range(20):
+ # We need to wait until the server starts, but not forever. It can
+ # take a Berkeley storage more than 10 seconds to start.
+ for i in range(120):
time.sleep(0.25)
+ logger.debug("connect %s", i)
try:
- logger.debug("connect %s", i)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(adminaddr)
ack = s.recv(1024)
s.close()
- logger.debug("acked: %s", ack)
- break
except socket.error, e:
if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET):
raise
s.close()
+ else:
+ logger.debug("acked: %s", ack)
+ break
else:
logger.debug("boo foo")
raise
=== ZODB4/src/zodb/zeo/tests/zeoserver.py 1.9 => 1.10 ===
--- ZODB4/src/zodb/zeo/tests/zeoserver.py:1.9 Thu Jun 19 17:41:07 2003
+++ ZODB4/src/zodb/zeo/tests/zeoserver.py Tue Jun 24 18:25:23 2003
@@ -112,6 +112,9 @@
else:
level = logging.CRITICAL
logging.root.setLevel(level)
+ logini = os.getenv("LOGINI")
+ if logini:
+ logging.config.fileConfig(logini)
# Create a logger
logger = logging.getLogger('zeoserver.%d' % os.getpid())
More information about the Zodb-checkins
mailing list