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

Merge pull request #24 from zopefoundation/fix22

Fix #22
parents 0bde3265 9ad70632
language: python
sudo: false
python:
- 2.7
- 3.3
- 3.4
- pypy
matrix:
include:
- os: linux
python: 2.7
- 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:
- pip install -U setuptools
- python bootstrap.py
......
......@@ -609,6 +609,10 @@ class InvqTests(CommonSetupTearDown):
revid2 = self._dostore(oid2)
revid2 = self._dostore(oid2, revid2)
forker.wait_until(
lambda :
perstorage.lastTransaction() == self._storage.lastTransaction())
perstorage.load(oid, '')
perstorage.close()
......@@ -617,12 +621,6 @@ class InvqTests(CommonSetupTearDown):
revid = self._dostore(oid, revid)
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._server._last_invals,
(revid, [oid]))
......
......@@ -161,10 +161,10 @@ def start_zeo_server(storage_conf=None, zeo_conf=None, port=None, keep=False,
else:
pid = subprocess.Popen(args, env=d, close_fds=True).pid
# We need to wait until the server starts, but not forever.
# 30 seconds is a somewhat arbitrary upper bound. A BDBStorage
# takes a long time to open -- more than 10 seconds on occasion.
for i in range(300):
# We need to wait until the server starts, but not forever. 150
# seconds is a somewhat arbitrary upper bound, but probably helps
# in an address already in use situation.
for i in range(1500):
time.sleep(0.1)
try:
if isinstance(adminaddr, str) and not os.path.exists(adminaddr):
......
......@@ -1227,9 +1227,9 @@ def client_asyncore_thread_has_name():
"""
>>> addr, _ = start_server()
>>> db = ZEO.DB(addr)
>>> len([t for t in threading.enumerate()
... if ' zeo client networking thread' in t.getName()])
1
>>> any(t for t in threading.enumerate()
... if ' zeo client networking thread' in t.getName())
True
>>> db.close()
"""
......
......@@ -51,7 +51,7 @@ def client_loop(map):
try:
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,
# which is not subscriptable but does have the 'errno' attribute
err_errno = getattr(err, 'errno', None) or err[0]
......@@ -69,6 +69,13 @@ def client_loop(map):
if [fd for fd in w if fd not in map]:
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
else:
continue
......
......@@ -70,7 +70,19 @@ class Dispatcher(asyncore.dispatcher):
self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.set_reuse_addr()
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)
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