Commit 6d05cc16 authored by Jim Fulton's avatar Jim Fulton

Merge pull request #24 from zopefoundation/fix22

Fix #22
parents 0bde3265 9ad70632
language: python language: python
sudo: false sudo: false
python: matrix:
- 2.7 include:
- 3.3 - os: linux
- 3.4 python: 2.7
- pypy - os: linux
python: 3.3
- os: linux
python: 3.4
- os: linux
python: 3.5
- os: linux
python: pypy
- os: osx
language: generic
env: TERRYFY_PYTHON='homebrew 2'
- os: osx
language: generic
env: TERRYFY_PYTHON='macpython 3.4'
- os: osx
language: generic
env: TERRYFY_PYTHON='homebrew 3'
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git clone https://github.com/MacPython/terryfy; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source terryfy/travis_tools.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then get_python_environment $TERRYFY_PYTHON venv; fi
- if [[ "$TERRYFY_PYTHON" == "homebrew 3" ]]; then alias pip=`which pip3` ; fi
install: install:
- pip install -U setuptools - pip install -U setuptools
- python bootstrap.py - python bootstrap.py
......
...@@ -609,6 +609,10 @@ class InvqTests(CommonSetupTearDown): ...@@ -609,6 +609,10 @@ class InvqTests(CommonSetupTearDown):
revid2 = self._dostore(oid2) revid2 = self._dostore(oid2)
revid2 = self._dostore(oid2, revid2) revid2 = self._dostore(oid2, revid2)
forker.wait_until(
lambda :
perstorage.lastTransaction() == self._storage.lastTransaction())
perstorage.load(oid, '') perstorage.load(oid, '')
perstorage.close() perstorage.close()
...@@ -617,12 +621,6 @@ class InvqTests(CommonSetupTearDown): ...@@ -617,12 +621,6 @@ class InvqTests(CommonSetupTearDown):
revid = self._dostore(oid, revid) revid = self._dostore(oid, revid)
perstorage = self.openClientStorage(cache="test") perstorage = self.openClientStorage(cache="test")
forker.wait_until(
func=(lambda : perstorage.verify_result == "quick verification"),
timeout=60,
label="perstorage.verify_result to be quick verification")
self.assertEqual(perstorage.verify_result, "quick verification") self.assertEqual(perstorage.verify_result, "quick verification")
self.assertEqual(perstorage._server._last_invals, self.assertEqual(perstorage._server._last_invals,
(revid, [oid])) (revid, [oid]))
......
...@@ -161,10 +161,10 @@ def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False, ...@@ -161,10 +161,10 @@ def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
else: else:
pid = subprocess.Popen(args, env=d, close_fds=True).pid pid = subprocess.Popen(args, env=d, close_fds=True).pid
# We need to wait until the server starts, but not forever. # We need to wait until the server starts, but not forever. 150
# 30 seconds is a somewhat arbitrary upper bound. A BDBStorage # seconds is a somewhat arbitrary upper bound, but probably helps
# takes a long time to open -- more than 10 seconds on occasion. # in an address already in use situation.
for i in range(300): for i in range(1500):
time.sleep(0.1) time.sleep(0.1)
try: try:
if isinstance(adminaddr, str) and not os.path.exists(adminaddr): if isinstance(adminaddr, str) and not os.path.exists(adminaddr):
......
...@@ -1227,9 +1227,9 @@ def client_asyncore_thread_has_name(): ...@@ -1227,9 +1227,9 @@ def client_asyncore_thread_has_name():
""" """
>>> addr, _ = start_server() >>> addr, _ = start_server()
>>> db = ZEO.DB(addr) >>> db = ZEO.DB(addr)
>>> len([t for t in threading.enumerate() >>> any(t for t in threading.enumerate()
... if ' zeo client networking thread' in t.getName()]) ... if ' zeo client networking thread' in t.getName())
1 True
>>> db.close() >>> db.close()
""" """
......
...@@ -51,7 +51,7 @@ def client_loop(map): ...@@ -51,7 +51,7 @@ def client_loop(map):
try: try:
r, w, e = select.select(r, w, e, client_timeout()) r, w, e = select.select(r, w, e, client_timeout())
except select.error as err: except (select.error, RuntimeError) as err:
# Python >= 3.3 makes select.error an alias of OSError, # Python >= 3.3 makes select.error an alias of OSError,
# which is not subscriptable but does have the 'errno' attribute # which is not subscriptable but does have the 'errno' attribute
err_errno = getattr(err, 'errno', None) or err[0] err_errno = getattr(err, 'errno', None) or err[0]
...@@ -69,6 +69,13 @@ def client_loop(map): ...@@ -69,6 +69,13 @@ def client_loop(map):
if [fd for fd in w if fd not in map]: if [fd for fd in w if fd not in map]:
continue continue
# Hm, on Mac OS X, we could get a run time
# error and end up here, but retrying select
# would work. Let's try:
select.select(r, w, e, 0)
# we survived, keep going :)
continue
raise raise
else: else:
continue continue
......
...@@ -70,7 +70,19 @@ class Dispatcher(asyncore.dispatcher): ...@@ -70,7 +70,19 @@ class Dispatcher(asyncore.dispatcher):
self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM) self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.set_reuse_addr() self.set_reuse_addr()
log("listening on %s" % str(self.addr), logging.INFO) log("listening on %s" % str(self.addr), logging.INFO)
self.bind(self.addr)
for i in range(25):
try:
self.bind(self.addr)
except Exception as exc:
log("bind failed %s waiting", i)
if i == 24:
raise
else:
time.sleep(5)
else:
break
self.listen(5) self.listen(5)
def writable(self): def writable(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment