Hello community, here is the log from the commit of package python-billiard for openSUSE:Factory checked in at 2019-02-11 21:27:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-billiard (Old) and /work/SRC/openSUSE:Factory/.python-billiard.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-billiard" Mon Feb 11 21:27:59 2019 rev:15 rq:673155 version:3.6.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-billiard/python-billiard.changes 2018-12-13 19:47:35.840766758 +0100 +++ /work/SRC/openSUSE:Factory/.python-billiard.new.28833/python-billiard.changes 2019-02-11 21:28:00.954995416 +0100 @@ -1,0 +2,10 @@ +Sun Feb 10 13:31:32 UTC 2019 - John Vandenberg <jay...@gmail.com> + +- Update to v3.6.0.0 + + Add support of sending parent process death signal. + + Previous fix for handling timeouts caused a problem in warm shutdowns + due to use of deepcopy. + We now use a shallow copy of the cache and do so only when it is needed. + + Cleanup old checks and workarounds for Python versions we no longer support. + +------------------------------------------------------------------- Old: ---- billiard-3.5.0.5.tar.gz New: ---- billiard-3.6.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-billiard.spec ++++++ --- /var/tmp/diff_new_pack.Lwgg5D/_old 2019-02-11 21:28:01.438995154 +0100 +++ /var/tmp/diff_new_pack.Lwgg5D/_new 2019-02-11 21:28:01.446995150 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-billiard # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-billiard -Version: 3.5.0.5 +Version: 3.6.0.0 Release: 0 Summary: Python multiprocessing fork License: BSD-3-Clause @@ -26,6 +26,7 @@ URL: https://github.com/celery/billiard Source: https://files.pythonhosted.org/packages/source/b/billiard/billiard-%{version}.tar.gz BuildRequires: %{python_module case >= 1.3.1} +BuildRequires: %{python_module psutil} BuildRequires: %{python_module pytest >= 3.0} BuildRequires: %{python_module setuptools} BuildRequires: fdupes ++++++ billiard-3.5.0.5.tar.gz -> billiard-3.6.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/CHANGES.txt new/billiard-3.6.0.0/CHANGES.txt --- old/billiard-3.5.0.5/CHANGES.txt 2018-12-03 12:48:02.000000000 +0100 +++ new/billiard-3.6.0.0/CHANGES.txt 2019-02-04 06:56:37.000000000 +0100 @@ -1,3 +1,15 @@ +3.6.0.0 - 2018-02-04 +-------------------- + +- Add support of sending parent process death signal. + +- Previous fix for handling timeouts caused a problem in warm shutdowns due + to use of deepcopy. + + We now use a shallow copy of the cache and do so only when it is needed. + +- Cleanup old checks and workarounds for Python versions we no longer support. + 3.5.0.5 - 2018-12-03 -------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/PKG-INFO new/billiard-3.6.0.0/PKG-INFO --- old/billiard-3.5.0.5/PKG-INFO 2018-12-03 12:49:09.000000000 +0100 +++ new/billiard-3.6.0.0/PKG-INFO 2019-02-04 07:00:30.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: billiard -Version: 3.5.0.5 +Version: 3.6.0.0 Summary: Python multiprocessing fork with improvements and bugfixes Home-page: https://github.com/celery/billiard Author: R Oudkerk / Python Software Foundation @@ -11,7 +11,7 @@ Description: ======== billiard ======== - :version: 3.5.0.4 + :version: 3.6.0.0 |build-status-lin| |build-status-win| |license| |wheel| |pyversion| |pyimp| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/README.rst new/billiard-3.6.0.0/README.rst --- old/billiard-3.5.0.5/README.rst 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/README.rst 2019-02-04 06:57:33.000000000 +0100 @@ -1,7 +1,7 @@ ======== billiard ======== -:version: 3.5.0.4 +:version: 3.6.0.0 |build-status-lin| |build-status-win| |license| |wheel| |pyversion| |pyimp| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/billiard/__init__.py new/billiard-3.6.0.0/billiard/__init__.py --- old/billiard-3.5.0.5/billiard/__init__.py 2018-12-03 12:27:21.000000000 +0100 +++ new/billiard-3.6.0.0/billiard/__init__.py 2019-02-04 06:57:14.000000000 +0100 @@ -22,7 +22,7 @@ import sys from . import context -VERSION = (3, 5, 0, 5) +VERSION = (3, 6, 0, 0) __version__ = '.'.join(map(str, VERSION[0:4])) + "".join(VERSION[4:]) __author__ = 'R Oudkerk / Python Software Foundation' __author_email__ = 'python-...@python.org' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/billiard/common.py new/billiard-3.6.0.0/billiard/common.py --- old/billiard-3.5.0.5/billiard/common.py 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/billiard/common.py 2019-02-04 06:39:49.000000000 +0100 @@ -17,15 +17,9 @@ from .exceptions import RestartFreqExceeded from .five import monotonic -if sys.version_info < (2, 6): # pragma: no cover - # cPickle does not use absolute_imports - pickle = pypickle - pickle_load = pypickle.load - pickle_loads = pypickle.loads -else: - pickle = cpickle or pypickle - pickle_load = pickle.load - pickle_loads = pickle.loads +pickle = cpickle or pypickle +pickle_load = pickle.load +pickle_loads = pickle.loads # cPickle.loads does not support buffer() objects, # but we can just create a StringIO and use load. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/billiard/pool.py new/billiard-3.6.0.0/billiard/pool.py --- old/billiard-3.5.0.5/billiard/pool.py 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/billiard/pool.py 2019-02-04 06:39:49.000000000 +0100 @@ -694,7 +694,6 @@ pass def handle_timeouts(self): - cache = copy.deepcopy(self.cache) t_hard, t_soft = self.t_hard, self.t_soft dirty = set() on_soft_timeout = self.on_soft_timeout @@ -708,12 +707,16 @@ # Inner-loop while self._state == RUN: + # Perform a shallow copy before iteration because keys can change. + # A deep copy fails (on shutdown) due to thread.lock objects. + # https://github.com/celery/billiard/issues/260 + cache = copy.copy(self.cache) # Remove dirty items not in cache anymore if dirty: dirty = set(k for k in dirty if k in cache) - for i, job in list(cache.items()): + for i, job in cache.items(): ack_time = job._time_accepted soft_timeout = job._soft_timeout if soft_timeout is None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/billiard/util.py new/billiard-3.6.0.0/billiard/util.py --- old/billiard-3.5.0.5/billiard/util.py 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/billiard/util.py 2019-01-06 15:47:21.000000000 +0100 @@ -14,6 +14,11 @@ import atexit try: + import cffi +except ImportError: + import ctypes + +try: from subprocess import _args_from_interpreter_flags # noqa except ImportError: # pragma: no cover def _args_from_interpreter_flags(): # noqa @@ -65,6 +70,11 @@ 'SUBDEBUG', 'SUBWARNING', ] + +# Constants from prctl.h +PR_GET_PDEATHSIG = 2 +PR_SET_PDEATHSIG = 1 + # # Logging # @@ -156,6 +166,53 @@ return _logger +def get_pdeathsig(): + """ + Return the current value of the parent process death signal + """ + if not sys.platform.startswith('linux'): + # currently we support only linux platform. + raise OSError() + try: + if 'cffi' in sys.modules: + ffi = cffi.FFI() + ffi.cdef("int prctl (int __option, ...);") + arg = ffi.new("int *") + C = ffi.dlopen(None) + C.prctl(PR_GET_PDEATHSIG, arg) + return arg[0] + else: + sig = ctypes.c_int() + libc = ctypes.cdll.LoadLibrary("libc.so.6") + libc.prctl(PR_GET_PDEATHSIG, ctypes.byref(sig)) + return sig.value + except Exception: + raise OSError() + + +def set_pdeathsig(sig): + """ + Set the parent process death signal of the calling process to sig + (either a signal value in the range 1..maxsig, or 0 to clear). + This is the signal that the calling process will get when its parent dies. + This value is cleared for the child of a fork(2) and + (since Linux 2.4.36 / 2.6.23) when executing a set-user-ID or set-group-ID binary. + """ + if not sys.platform.startswith('linux'): + # currently we support only linux platform. + raise OSError() + try: + if 'cffi' in sys.modules: + ffi = cffi.FFI() + ffi.cdef("int prctl (int __option, ...);") + C = ffi.dlopen(None) + C.prctl(PR_SET_PDEATHSIG, ffi.cast("int", sig)) + else: + libc = ctypes.cdll.LoadLibrary("libc.so.6") + libc.prctl(PR_SET_PDEATHSIG, sig) + except Exception: + raise OSError() + def _eintr_retry(func): ''' Automatic retry after EINTR. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/billiard.egg-info/PKG-INFO new/billiard-3.6.0.0/billiard.egg-info/PKG-INFO --- old/billiard-3.5.0.5/billiard.egg-info/PKG-INFO 2018-12-03 12:49:09.000000000 +0100 +++ new/billiard-3.6.0.0/billiard.egg-info/PKG-INFO 2019-02-04 07:00:30.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: billiard -Version: 3.5.0.5 +Version: 3.6.0.0 Summary: Python multiprocessing fork with improvements and bugfixes Home-page: https://github.com/celery/billiard Author: R Oudkerk / Python Software Foundation @@ -11,7 +11,7 @@ Description: ======== billiard ======== - :version: 3.5.0.4 + :version: 3.6.0.0 |build-status-lin| |build-status-win| |license| |wheel| |pyversion| |pyimp| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/requirements/test.txt new/billiard-3.6.0.0/requirements/test.txt --- old/billiard-3.5.0.5/requirements/test.txt 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/requirements/test.txt 2019-01-06 15:47:21.000000000 +0100 @@ -1,2 +1,3 @@ case>=1.3.1 pytest>=3.0 +psutil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/setup.py new/billiard-3.6.0.0/setup.py --- old/billiard-3.5.0.5/setup.py 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/setup.py 2019-02-04 06:39:49.000000000 +0100 @@ -16,7 +16,7 @@ HERE = os.path.dirname(os.path.abspath(__file__)) ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) -if sys.platform == 'win32' and sys.version_info >= (2, 6): +if sys.platform == 'win32': # distutils.msvc9compiler can raise IOError if the compiler is missing ext_errors += (IOError, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/t/unit/test_pool.py new/billiard-3.6.0.0/t/unit/test_pool.py --- old/billiard-3.5.0.5/t/unit/test_pool.py 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/t/unit/test_pool.py 2019-02-04 06:39:49.000000000 +0100 @@ -8,3 +8,13 @@ assert pool.did_start_ok() is True pool.close() pool.terminate() + + def test_timeout_handler_iterates_with_cache(self): + # Given a pool + pool = billiard.pool.Pool() + # If I have a cache containing async results + cache = {n: pool.apply_async(n) for n in range(4)} + # And a TimeoutHandler with that cache + timeout_handler = pool.TimeoutHandler(pool._pool, cache, 0, 0) + # If I call to handle the timeouts I expect no exception + next(timeout_handler.handle_timeouts()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/t/unit/test_spawn.py new/billiard-3.6.0.0/t/unit/test_spawn.py --- old/billiard-3.5.0.5/t/unit/test_spawn.py 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/t/unit/test_spawn.py 2019-01-06 15:47:21.000000000 +0100 @@ -1,6 +1,12 @@ from __future__ import absolute_import -from billiard import get_context +import sys +from billiard import get_context, Value, Process, Event +from billiard.util import set_pdeathsig, get_pdeathsig +import pytest +import psutil +import signal +from time import sleep class test_spawn: def test_start(self): @@ -11,6 +17,38 @@ p.join() return p.exitcode + @pytest.mark.skipif(not sys.platform.startswith('linux'), + reason='set_pdeathsig() is supported only in Linux') + def test_set_pdeathsig(self): + return_pid = Value('i') + p = Process(target=parent_task, args=(return_pid,)) + p.start() + sleep(3) # wait for setting pdeathsig + p.terminate() + sleep(3) # wait for process termination + with pytest.raises(psutil.NoSuchProcess): + proc = psutil.Process(return_pid.value) + + @pytest.mark.skipif(not sys.platform.startswith('linux'), + reason='get_pdeathsig() is supported only in Linux') + def test_set_get_pdeathsig(self): + sig = get_pdeathsig() + assert sig == 0 + set_pdeathsig(signal.SIGTERM) + sig = get_pdeathsig() + assert sig == signal.SIGTERM + +def child_process(): + set_pdeathsig(signal.SIGTERM) + while True: + sleep(1) + +def parent_task(return_pid): + p = Process(target=child_process) + p.start() + sleep(1) # Wait for starting process + return_pid.value = p.pid + def task_from_process(name): print('proc:', name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/billiard-3.5.0.5/t/unit/test_win32.py new/billiard-3.6.0.0/t/unit/test_win32.py --- old/billiard-3.5.0.5/t/unit/test_win32.py 2018-12-03 12:24:37.000000000 +0100 +++ new/billiard-3.6.0.0/t/unit/test_win32.py 2019-01-06 15:47:21.000000000 +0100 @@ -1,8 +1,10 @@ from __future__ import absolute_import import pytest +import signal from case import skip +from billiard.util import set_pdeathsig, get_pdeathsig from billiard.compat import _winapi @@ -68,3 +70,11 @@ ]) def test_functions(self, name): assert getattr(_winapi, name) + + def test_set_pdeathsig(self): + with pytest.raises(OSError): + set_pdeathsig(signal.SIGTERM) + + def test_get_pdeathsig(self): + with pytest.raises(OSError): + get_pdeathsig()