From 2e54cff0db213494d07c72ce0f36d60831d2e84d Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Thu, 2 May 2019 23:20:48 +0200 Subject: [PATCH] Use oslo_rootwrap subprocess module in order to gain proper eventlet awareness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Via https://github.com/openstack/oslo.rootwrap/commit/31cfdbd4076bb6556cf9612171ba43fa44475d71 oslo.rootwrap gained support eventlet when using subprocess. By moving to oslo_rootwrap.subprocess we make sure that with python3 the subprocess calls use eventlet.green.subprocess if eventlet is used. This worked on python2 because (from above commit): """ On Python 2, it "works" to use directly subprocess: subprocess.Popen calls os.pipe() and os.fdopen(fd) which are both monkey-patched. On Python 3, it doesn't work because subprocess uses os.pipe() and io.open(fd), and the io module is *not* monkey-patched at all. """ By applying this change what happens is that the heartbeat thread is able to be scheduled every 15seconds by default. Without this patch what we have been observing with python3 is that while running ansible mistral would constantly log error messages like the following: 2019-05-02 19:14:36.702 8 WARNING oslo.messaging._drivers.impl_rabbit [-] Unexpected error during heartbeart thread processing, retrying...: amqp.exceptions.ConnectionForced: Too many heartbeats missed With this change we could not reproduce this issue during a deployment and no missed heartbeat messages were observed during the deploy. Co-Authored-By: Damien Ciabrini Co-Authored-By: Hervé Beraud Closes-Bug: #1826281 Change-Id: Id22b1465d6d2424d90781983b970aba4545feb8a --- lower-constraints.txt | 1 + requirements.txt | 1 + tripleo_common/actions/ansible.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 550828e82..b2b0feb93 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -56,6 +56,7 @@ oslo.config==5.2.0 oslo.context==2.19.2 oslo.i18n==3.15.3 oslo.log==3.36.0 +oslo.rootwrap==5.8.0 oslo.serialization==2.18.0 oslo.utils==3.33.0 oslotest==3.2.0 diff --git a/requirements.txt b/requirements.txt index c304a4be1..51b6b6046 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,7 @@ eventlet!=0.20.1,>=0.20.0 # MIT python-heatclient>=1.10.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 +oslo.rootwrap>=5.8.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 python-glanceclient>=2.8.0 # Apache-2.0 python-ironicclient>=2.3.0 # Apache-2.0 diff --git a/tripleo_common/actions/ansible.py b/tripleo_common/actions/ansible.py index d865f62e7..714827b84 100644 --- a/tripleo_common/actions/ansible.py +++ b/tripleo_common/actions/ansible.py @@ -20,7 +20,6 @@ import shutil import six from six.moves import configparser from six.moves import cStringIO as StringIO -import subprocess import sys import tempfile import time @@ -28,6 +27,7 @@ import yaml from mistral_lib import actions from oslo_concurrency import processutils +from oslo_rootwrap import subprocess from tripleo_common.actions import base from tripleo_common import constants