diff --git a/SOURCES/sos-3.7-centos-branding.patch b/SOURCES/sos-3.7-centos-branding.patch deleted file mode 100644 index 429db6b..0000000 --- a/SOURCES/sos-3.7-centos-branding.patch +++ /dev/null @@ -1,106 +0,0 @@ -diff -uNrp sos-3.6.orig/sos/policies/redhat.py sos-3.6/sos/policies/redhat.py ---- sos-3.6.orig/sos/policies/redhat.py 2018-11-04 17:44:59.513116585 +0000 -+++ sos-3.6/sos/policies/redhat.py 2018-11-04 17:53:28.333731059 +0000 -@@ -32,9 +32,9 @@ OS_RELEASE = "/etc/os-release" - - - class RedHatPolicy(LinuxPolicy): -- distro = "Red Hat" -- vendor = "Red Hat" -- vendor_url = "http://www.redhat.com/" -+ distro = "CentOS" -+ vendor = "CentOS" -+ vendor_url = "http://www,centos.org/" - _redhat_release = '/etc/redhat-release' - _tmp_dir = "/var/tmp" - _rpmq_cmd = 'rpm -qa --queryformat "%{NAME}|%{VERSION}|%{RELEASE}\\n"' -@@ -92,9 +92,9 @@ class RedHatPolicy(LinuxPolicy): - - @classmethod - def check(cls): -- """This method checks to see if we are running on Red Hat. It must be -+ """This method checks to see if we are running on CentOS. It must be - overriden by concrete subclasses to return True when running on a -- Fedora, RHEL or other Red Hat distribution or False otherwise.""" -+ Fedora, RHEL or CentOS distribution or False otherwise.""" - return False - - def check_usrmove(self, pkgs): -@@ -185,7 +185,7 @@ class RedHatPolicy(LinuxPolicy): - return self.host_name() - - --# Container environment variables on Red Hat systems. -+# Container environment variables on CentOS systems. - ENV_CONTAINER = 'container' - ENV_HOST_SYSROOT = 'HOST' - -@@ -230,9 +230,9 @@ rhel_presets = { - - - class RHELPolicy(RedHatPolicy): -- distro = RHEL_RELEASE_STR -- vendor = "Red Hat" -- vendor_url = "https://access.redhat.com/support/" -+ distro = "CentOS Linux" -+ vendor = "CentOS" -+ vendor_url = "https://wiki.centos.org/" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system and installed \ -@@ -262,7 +262,7 @@ No changes will be made to system config - def check(cls): - """Test to see if the running host is a RHEL installation. - -- Checks for the presence of the "Red Hat Enterprise Linux" -+ Checks for the presence of the "CentOS Linux" - release string at the beginning of the NAME field in the - `/etc/os-release` file and returns ``True`` if it is - found, and ``False`` otherwise. -@@ -324,7 +324,7 @@ No changes will be made to system config - - ATOMIC = "atomic" - ATOMIC_RELEASE_STR = "Atomic" --ATOMIC_DESC = "Red Hat Enterprise Linux Atomic Host" -+ATOMIC_DESC = "CentOS Linux Atomic Host" - - atomic_presets = { - ATOMIC: PresetDefaults(name=ATOMIC, desc=ATOMIC_DESC, note=NOTE_TIME, -@@ -333,7 +333,7 @@ atomic_presets = { - - - class RedHatAtomicPolicy(RHELPolicy): -- distro = "Red Hat Atomic Host" -+ distro = "CentOS Atomic Host" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system. -diff -uNrp sos-3.7.orig/sos/policies/redhat.py sos-3.7/sos/policies/redhat.py ---- sos-3.7.orig/sos/policies/redhat.py 2019-08-07 15:24:23.198233507 +0000 -+++ sos-3.7/sos/policies/redhat.py 2019-08-07 15:29:08.324131718 +0000 -@@ -198,7 +198,7 @@ _cb_plugs = ['abrt', 'block', 'boot', 'd - 'hardware', 'host', 'kernel', 'logs', 'lvm2', 'memory', 'rpm', - 'process', 'systemd', 'yum', 'xfs'] - --RHEL_RELEASE_STR = "Red Hat Enterprise Linux" -+RHEL_RELEASE_STR = "CentOS Linux" - - RHV = "rhv" - RHV_DESC = "Red Hat Virtualization" -@@ -207,13 +207,13 @@ RHEL = "rhel" - RHEL_DESC = RHEL_RELEASE_STR - - RHOSP = "rhosp" --RHOSP_DESC = "Red Hat OpenStack Platform" -+RHOSP_DESC = "RDO" - - RHOCP = "ocp" --RHOCP_DESC = "OpenShift Container Platform by Red Hat" -+RHOCP_DESC = "OpenShift" - - RH_SATELLITE = "satellite" --RH_SATELLITE_DESC = "Red Hat Satellite" -+RH_SATELLITE_DESC = "Satellite" - SAT_OPTS = SoSOptions(verify=True, plugopts=['apache.log=on']) - - CB = "cantboot" diff --git a/SOURCES/sos-bz1736422-cmd-poll-performance.patch b/SOURCES/sos-bz1736422-cmd-poll-performance.patch new file mode 100644 index 0000000..7ab2e4c --- /dev/null +++ b/SOURCES/sos-bz1736422-cmd-poll-performance.patch @@ -0,0 +1,55 @@ +From 3253179b207c2616ce238e2bb765635fe59e6dd2 Mon Sep 17 00:00:00 2001 +From: Kazuhito Hagio +Date: Thu, 18 Jul 2019 09:58:56 -0400 +Subject: [PATCH] [utilities] Fix high CPU usage and slow command collection + +commit fc6721ac83c2 ("[Plugin] Terminate running commands when a plugin +exceeds timeout") introduced a polling method to sos_get_command_output() +but it is busy wait, and seems to increase the CPU usage and slow down +AsyncReader significantly. + +As a result, a command that outputs much data like journalctl takes +longer time, and the plugin times out. + +Inserting a sleep is a possible fix for this. + +Resolves: #1732 + +Signed-off-by: Kazuhito Hagio +Signed-off-by: Bryn M. Reeves +--- + sos/utilities.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/sos/utilities.py b/sos/utilities.py +index 1737478f..c3d6ac20 100644 +--- a/sos/utilities.py ++++ b/sos/utilities.py +@@ -18,6 +18,7 @@ import errno + import shlex + import glob + import threading ++import time + + from contextlib import closing + from collections import deque +@@ -158,6 +159,7 @@ def sos_get_command_output(command, timeout=300, stderr=False, + if poller(): + p.terminate() + raise SoSTimeoutError ++ time.sleep(0.01) + stdout = reader.get_contents() + while p.poll() is None: + pass +@@ -248,7 +250,7 @@ class AsyncReader(threading.Thread): + # block until command completes or timesout (separate from the plugin + # hitting a timeout) + while self.running: +- pass ++ time.sleep(0.01) + if not self.binary: + return ''.join(ln.decode('utf-8', 'ignore') for ln in self.deque) + else: +-- +2.21.0 + diff --git a/SOURCES/sos-bz1736424-timeouted-plugin-stop-further-collection.patch b/SOURCES/sos-bz1736424-timeouted-plugin-stop-further-collection.patch new file mode 100644 index 0000000..19da03a --- /dev/null +++ b/SOURCES/sos-bz1736424-timeouted-plugin-stop-further-collection.patch @@ -0,0 +1,63 @@ +From 8ad1f5977adfa11880aae4144d554ad1cc99ad63 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Fri, 26 Jul 2019 11:44:53 +0200 +Subject: [PATCH] [plugins] Stop plugin execution after timeout hit + +When a plugin timeouts, it must stop collecting further data. Otherwise +a race issues with archive.finalize() can happen. + +So any data collection must be skipped if _timeout_hit is True. + +Resolves: #1736 + +Signed-off-by: Pavel Moravec +--- + sos/plugins/__init__.py | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py +index e5bb39ee..aa268d84 100644 +--- a/sos/plugins/__init__.py ++++ b/sos/plugins/__init__.py +@@ -652,6 +652,9 @@ class Plugin(object): + everything below it is recursively copied. A list of copied files are + saved for use later in preparing a report. + ''' ++ if self._timeout_hit: ++ return ++ + if self._is_forbidden_path(srcpath): + self._log_debug("skipping forbidden path '%s'" % srcpath) + return '' +@@ -852,6 +855,9 @@ class Plugin(object): + def get_command_output(self, prog, timeout=300, stderr=True, + chroot=True, runat=None, env=None, + binary=False, sizelimit=None): ++ if self._timeout_hit: ++ return ++ + if chroot or self.commons['cmdlineopts'].chroot == 'always': + root = self.sysroot + else: +@@ -1012,6 +1018,9 @@ class Plugin(object): + """Execute a command and save the output to a file for inclusion in the + report. + """ ++ if self._timeout_hit: ++ return ++ + start = time() + + result = self.get_command_output(exe, timeout=timeout, stderr=stderr, +@@ -1201,6 +1210,8 @@ class Plugin(object): + + def _collect_strings(self): + for string, file_name in self.copy_strings: ++ if self._timeout_hit: ++ return + content = '' + if string: + content = string.splitlines()[0] +-- +2.21.0 + diff --git a/SPECS/sos.spec b/SPECS/sos.spec index eadfcec..5e31b73 100644 --- a/SPECS/sos.spec +++ b/SPECS/sos.spec @@ -2,7 +2,7 @@ Summary: A set of tools to gather troubleshooting information from a system Name: sos Version: 3.7 -Release: 5%{?dist} +Release: 6%{?dist} Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz License: GPLv2+ @@ -27,7 +27,8 @@ Patch5: sos-bz1311129-sos-conf-disabled-plugins-manpages.patch Patch6: sos-bz1702802-openstack_instack-ansible-log.patch Patch7: sos-bz1706060-vdsm-plugin.patch Patch8: sos-bz1711305-katello-qpid-certificate.patch -Patch9: sos-3.7-centos-branding.patch +Patch9: sos-bz1736424-timeouted-plugin-stop-further-collection.patch +Patch10: sos-bz1736422-cmd-poll-performance.patch %description @@ -48,6 +49,7 @@ support technicians and developers. %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 %build make @@ -71,8 +73,11 @@ rm -rf ${RPM_BUILD_ROOT} %config(noreplace) %{_sysconfdir}/sos.conf %changelog -* Tue Aug 06 2019 CentOS Sources - 3.7-5.el7.centos -- Roll in CentOS Branding +* Thu Aug 01 2019 Pavel Moravec = 3.7-6 +- [utilities] Fix high CPU usage and slow command collection + Resolves: bz1736422 +- [sosreport,plugins] Stop plugin execution after timeout hit + Resolves: bz1736424 * Tue Jun 25 2019 Pavel Moravec = 3.7-5 - Updates to vdsm plugin