[ARVADOS] created: 99c19e1539aabb8053ee9221f62744bf76d63737

Git user git at public.curoverse.com
Tue Aug 29 09:31:58 EDT 2017


        at  99c19e1539aabb8053ee9221f62744bf76d63737 (commit)


commit 99c19e1539aabb8053ee9221f62744bf76d63737
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Fri Aug 18 15:43:49 2017 -0400

    12134: Minimize multiprocessing worker startups.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/fuse/tests/integration_test.py b/services/fuse/tests/integration_test.py
index 6a0c5de..3c11fa2 100644
--- a/services/fuse/tests/integration_test.py
+++ b/services/fuse/tests/integration_test.py
@@ -17,12 +17,8 @@ import sys
 import tempfile
 import unittest
 
-_pool = None
-
-
 @atexit.register
 def _pool_cleanup():
-    global _pool
     if _pool is None:
         return
     _pool.close()
@@ -36,6 +32,17 @@ def wrap_static_test_method(modName, clsName, funcName, args, kwargs):
     Test().runTest(*args, **kwargs)
 
 
+# To avoid Python's threading+multiprocessing=deadlock problems, we
+# use a single global pool with maxtasksperchild=None for the entire
+# test suite.
+_pool = None
+def workerPool():
+    global _pool
+    if _pool is None:
+        _pool = multiprocessing.Pool(processes=1, maxtasksperchild=None)
+    return _pool
+
+
 class IntegrationTest(unittest.TestCase):
     def pool_test(self, *args, **kwargs):
         """Run a static method as a unit test, in a different process.
@@ -43,13 +50,10 @@ class IntegrationTest(unittest.TestCase):
         If called by method 'foobar', the static method '_foobar' of
         the same class will be called in the other process.
         """
-        global _pool
-        if _pool is None:
-            _pool = multiprocessing.Pool(1, maxtasksperchild=1)
         modName = inspect.getmodule(self).__name__
         clsName = self.__class__.__name__
         funcName = inspect.currentframe().f_back.f_code.co_name
-        _pool.apply(
+        workerPool().apply(
             wrap_static_test_method,
             (modName, clsName, '_'+funcName, args, kwargs))
 
diff --git a/services/fuse/tests/mount_test_base.py b/services/fuse/tests/mount_test_base.py
index 8518d8b..d476fc7 100644
--- a/services/fuse/tests/mount_test_base.py
+++ b/services/fuse/tests/mount_test_base.py
@@ -21,6 +21,8 @@ import unittest
 
 logger = logging.getLogger('arvados.arv-mount')
 
+from .integration_test import workerPool
+
 class MountTestBase(unittest.TestCase):
     def setUp(self, api=None, local_store=True):
         # The underlying C implementation of open() makes a fstat() syscall
@@ -30,8 +32,8 @@ class MountTestBase(unittest.TestCase):
         # deadlocks.  The workaround is to run some of our test code in a
         # separate process.  Forturnately the multiprocessing module makes this
         # relatively easy.
-        self.pool = multiprocessing.Pool(1)
 
+        self.pool = workerPool()
         if local_store:
             self.keeptmp = tempfile.mkdtemp()
             os.environ['KEEP_LOCAL_STORE'] = self.keeptmp
@@ -89,8 +91,6 @@ class MountTestBase(unittest.TestCase):
             shutil.rmtree(self.keeptmp)
             os.environ.pop('KEEP_LOCAL_STORE')
         run_test_server.reset()
-        self.pool.close()
-        self.pool.join()
 
     def assertDirContents(self, subdir, expect_content):
         path = self.mounttmp
diff --git a/services/fuse/tests/test_exec.py b/services/fuse/tests/test_exec.py
index 85cb5e4..ab6e131 100644
--- a/services/fuse/tests/test_exec.py
+++ b/services/fuse/tests/test_exec.py
@@ -10,6 +10,8 @@ import run_test_server
 import tempfile
 import unittest
 
+from .integration_test import workerPool
+
 try:
     from shlex import quote
 except:
@@ -44,16 +46,13 @@ class ExecMode(unittest.TestCase):
     def setUp(self):
         self.mnt = tempfile.mkdtemp()
         _, self.okfile = tempfile.mkstemp()
-        self.pool = multiprocessing.Pool(1)
 
     def tearDown(self):
-        self.pool.terminate()
-        self.pool.join()
         os.rmdir(self.mnt)
         os.unlink(self.okfile)
 
     def test_exec(self):
-        self.pool.apply(try_exec, (self.mnt, [
+        workerPool().apply(try_exec, (self.mnt, [
             'sh', '-c',
             'echo -n foo >{}; cp {} {}'.format(
                 quote(os.path.join(self.mnt, 'zzz', 'foo.txt')),

commit 545ea1b151eed2b9b86ae70180ec08a1d6ebc6e9
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Aug 17 11:41:07 2017 -0400

    12134: Use fixed/unreleased llfuse in test suite.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curoverse.com>

diff --git a/build/run-tests.sh b/build/run-tests.sh
index 2078081..905e516 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -468,11 +468,21 @@ pip freeze 2>/dev/null | egrep ^apache-libcloud==$LIBCLOUD_PIN \
     || pip install --pre --ignore-installed https://github.com/curoverse/libcloud/archive/apache-libcloud-$LIBCLOUD_PIN.zip >/dev/null \
     || fatal "pip install apache-libcloud failed"
 
-# Uninstall old llfuse (<1.0), because services/fuse "pip install"
-# won't upgrade it by default.
-if pip freeze | egrep '^llfuse==0'; then
-    yes | pip uninstall 'llfuse<1.0'
-fi
+# We need an unreleased (as of 2017-08-17) llfuse bugfix, otherwise our fuse test suite deadlocks.
+pip freeze | grep -x llfuse==1.2.0 || (
+    set -e
+    yes | pip uninstall llfuse || true
+    cython --version || fatal "no cython; try sudo apt-get install cython"
+    cd "$temp"
+    (cd python-llfuse || git clone https://github.com/curoverse/python-llfuse)
+    cd python-llfuse
+    git checkout 620722fd990ea642ddb8e7412676af482c090c0c
+    git checkout setup.py
+    sed -i -e "s:'1\\.2':'1.2.0':" setup.py
+    python setup.py build_cython
+    python setup.py install --force
+) || fatal "llfuse fork failed"
+pip freeze | grep -x llfuse==1.2.0 || fatal "error: installed llfuse 1.2.0 but '$(pip freeze | grep llfuse)' ???"
 
 # Deactivate Python 2 virtualenv
 deactivate

commit b32795897aef9bba7cc0f31c3cd1e14e50c237b9
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Aug 17 10:46:19 2017 -0400

    12134: Revert "10805: Skip llfuse.close() to avoid llfuse deadlocks in test suite."
    
    This reverts commit 07cd679b6526fcc9f2d3295f10751906e91872c9.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curoverse.com>

diff --git a/services/fuse/tests/integration_test.py b/services/fuse/tests/integration_test.py
index ba9cd88..6a0c5de 100644
--- a/services/fuse/tests/integration_test.py
+++ b/services/fuse/tests/integration_test.py
@@ -8,7 +8,6 @@ import arvados_fuse.command
 import atexit
 import functools
 import inspect
-import llfuse
 import logging
 import multiprocessing
 import os
@@ -77,10 +76,6 @@ class IntegrationTest(unittest.TestCase):
         def decorator(func):
             @functools.wraps(func)
             def wrapper(self, *args, **kwargs):
-                # Workaround for llfuse deadlock bug. See #10805, #8345,
-                # https://bitbucket.org/nikratio/python-llfuse/issues/108
-                llfuse.close = lambda *args: None
-
                 self.mount = None
                 try:
                     with arvados_fuse.command.Mount(
diff --git a/services/fuse/tests/mount_test_base.py b/services/fuse/tests/mount_test_base.py
index 96ff889..8518d8b 100644
--- a/services/fuse/tests/mount_test_base.py
+++ b/services/fuse/tests/mount_test_base.py
@@ -43,10 +43,6 @@ class MountTestBase(unittest.TestCase):
         self.api = api if api else arvados.safeapi.ThreadSafeApiCache(arvados.config.settings())
         self.llfuse_thread = None
 
-        # Workaround for llfuse deadlock bug. See #10805, #8345,
-        # https://bitbucket.org/nikratio/python-llfuse/issues/108
-        llfuse.close = lambda *args: None
-
     # This is a copy of Mount's method.  TODO: Refactor MountTestBase
     # to use a Mount instead of copying its code.
     def _llfuse_main(self):

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list