From a5d8ff06370b6c63377d3a6a7ee63c18f2e0874d Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Mon, 29 Apr 2019 17:38:26 -0700 Subject: [PATCH 1/2] The maximum for the multiprocessing queue on MacOS is 32767, so if we running on MacOS then we use that maximum. Conflicts: - tests/integration/files/log_handlers/runtests_log_handler.py --- salt/log/setup.py | 6 +++++- .../files/log_handlers/runtests_log_handler.py | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/salt/log/setup.py b/salt/log/setup.py index 91ac4728769f..e32f9005293b 100644 --- a/salt/log/setup.py +++ b/salt/log/setup.py @@ -812,13 +812,17 @@ def setup_extended_logging(opts): def get_multiprocessing_logging_queue(): global __MP_LOGGING_QUEUE + from salt.utils.platform import is_darwin if __MP_IN_MAINPROCESS is False: # We're not in the MainProcess, return! No Queue shall be instantiated return __MP_LOGGING_QUEUE if __MP_LOGGING_QUEUE is None: - __MP_LOGGING_QUEUE = multiprocessing.Queue(100000) + if is_darwin(): + __MP_LOGGING_QUEUE = multiprocessing.Queue(32767) + else: + __MP_LOGGING_QUEUE = multiprocessing.Queue(100000) return __MP_LOGGING_QUEUE diff --git a/tests/integration/files/log_handlers/runtests_log_handler.py b/tests/integration/files/log_handlers/runtests_log_handler.py index 457487febf97..c27599ffd91d 100644 --- a/tests/integration/files/log_handlers/runtests_log_handler.py +++ b/tests/integration/files/log_handlers/runtests_log_handler.py @@ -23,7 +23,8 @@ import msgpack # Import Salt libs -import salt.ext.six as six +from salt.ext import six +from salt.utils.platform import is_darwin import salt.log.setup log = logging.getLogger(__name__) @@ -60,7 +61,10 @@ def setup_handlers(): # Above that value, if `process_queue` can't process fast enough, # start dropping. This will contain a memory leak in case `process_queue` # can't process fast enough of in case it can't deliver the log records at all. - queue_size = 10000000 + if is_darwin(): + queue_size = 32767 + else: + queue_size = 10000000 queue = Queue(queue_size) handler = salt.log.setup.QueueHandler(queue) level = salt.log.setup.LOG_LEVELS[(__opts__.get('runtests_log_level') or 'error').lower()] From 4828608958a970dcd8627f35eaabc085d5aba39d Mon Sep 17 00:00:00 2001 From: Ch3LL Date: Tue, 21 May 2019 11:51:01 -0400 Subject: [PATCH 2/2] Fix salt.utils import in log setup --- salt/log/setup.py | 2 +- tests/integration/files/log_handlers/runtests_log_handler.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/log/setup.py b/salt/log/setup.py index e32f9005293b..c7e06e568038 100644 --- a/salt/log/setup.py +++ b/salt/log/setup.py @@ -812,7 +812,7 @@ def setup_extended_logging(opts): def get_multiprocessing_logging_queue(): global __MP_LOGGING_QUEUE - from salt.utils.platform import is_darwin + from salt.utils import is_darwin if __MP_IN_MAINPROCESS is False: # We're not in the MainProcess, return! No Queue shall be instantiated diff --git a/tests/integration/files/log_handlers/runtests_log_handler.py b/tests/integration/files/log_handlers/runtests_log_handler.py index c27599ffd91d..9a2e3875225d 100644 --- a/tests/integration/files/log_handlers/runtests_log_handler.py +++ b/tests/integration/files/log_handlers/runtests_log_handler.py @@ -24,7 +24,7 @@ # Import Salt libs from salt.ext import six -from salt.utils.platform import is_darwin +from salt.utils import is_darwin import salt.log.setup log = logging.getLogger(__name__)