From 3f4a4391095d73c2d78dfb4db78934043e6b9aca Mon Sep 17 00:00:00 2001 From: John Kung Date: Fri, 9 Aug 2019 09:49:41 -0400 Subject: [PATCH] Fix socket growth on system application operations There is an issue whereby docker exec_run commands do not close the TCP socket. Thus on each kube application operation, such as application-apply, the docker exec_run consumes 4 TCP sockets per iteration. Thus, when it hits limit of 1024 sockets, system can no longer perform application operations. This updates the python-docker package. The source code was already in the cengn mirror; and this update adds a patch to finally close socket in docker client. Tests performed: Install AIO, Storage labs. system application-upload stx-openstack, apply, remove system application apply stress test of over 300 iterations and verify no growth in sockets held by sysinv-conductor. Change-Id: I21b9e486af1e3bb3b82fd79c3e3662c97b53b732 Closes-Bug: 1838088 Depends-On: https://review.opendev.org/#/c/675686/ Signed-off-by: John Kung --- centos_pkg_dirs | 1 + docker/python-docker/centos/build_srpm.data | 1 + .../0001-Add-package-versioning.patch | 25 +++++++++++++ ...0002-Update-spec-include-stx-patches.patch | 35 +++++++++++++++++++ .../centos/meta_patches/PATCH_ORDER | 2 ++ .../0001-Update-client-close-socket.patch | 28 +++++++++++++++ docker/python-docker/centos/srpm_path | 1 + 7 files changed, 93 insertions(+) create mode 100644 docker/python-docker/centos/build_srpm.data create mode 100644 docker/python-docker/centos/meta_patches/0001-Add-package-versioning.patch create mode 100644 docker/python-docker/centos/meta_patches/0002-Update-spec-include-stx-patches.patch create mode 100644 docker/python-docker/centos/meta_patches/PATCH_ORDER create mode 100644 docker/python-docker/centos/patches/0001-Update-client-close-socket.patch create mode 100644 docker/python-docker/centos/srpm_path diff --git a/centos_pkg_dirs b/centos_pkg_dirs index 40111ebc6..fd09d7890 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -83,6 +83,7 @@ kernel/kernel-modules/mlnx-ofa_kernel networking/mellanox/rdma-core monitoring/collectd-extensions monitoring/influxdb-extensions +docker/python-docker kubernetes/kubernetes kubernetes/docker-distribution kubernetes/etcd diff --git a/docker/python-docker/centos/build_srpm.data b/docker/python-docker/centos/build_srpm.data new file mode 100644 index 000000000..8aeb55368 --- /dev/null +++ b/docker/python-docker/centos/build_srpm.data @@ -0,0 +1 @@ +TIS_PATCH_VER=1 diff --git a/docker/python-docker/centos/meta_patches/0001-Add-package-versioning.patch b/docker/python-docker/centos/meta_patches/0001-Add-package-versioning.patch new file mode 100644 index 000000000..b4274ac19 --- /dev/null +++ b/docker/python-docker/centos/meta_patches/0001-Add-package-versioning.patch @@ -0,0 +1,25 @@ +From 9bc57c6963fcea63a7793633339e5692ec3e2252 Mon Sep 17 00:00:00 2001 +From: John Kung +Date: Wed, 7 Aug 2019 13:35:22 -0400 +Subject: [PATCH 1/1] Add package versioning patch + +--- + SPECS/python-docker.spec | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/SPECS/python-docker.spec b/SPECS/python-docker.spec +index 5ebf252..92420e3 100644 +--- a/SPECS/python-docker.spec ++++ b/SPECS/python-docker.spec +@@ -18,7 +18,7 @@ + + Name: python-%{srcname} + Version: 3.3.0 +-Release: 1%{?dist} ++Release: 1.el7%{?_tis_dist}.%{tis_patch_ver} + Summary: A Python library for the Docker Engine API + License: ASL 2.0 + URL: https://pypi.python.org/pypi/%{srcname} +-- +1.8.3.1 + diff --git a/docker/python-docker/centos/meta_patches/0002-Update-spec-include-stx-patches.patch b/docker/python-docker/centos/meta_patches/0002-Update-spec-include-stx-patches.patch new file mode 100644 index 000000000..26127099e --- /dev/null +++ b/docker/python-docker/centos/meta_patches/0002-Update-spec-include-stx-patches.patch @@ -0,0 +1,35 @@ +From a0c3f898cabd79b07cc6cc52245de712ee7b46bd Mon Sep 17 00:00:00 2001 +From: John Kung +Date: Wed, 7 Aug 2019 15:01:11 -0400 +Subject: [PATCH 1/1] Update-spec-include-stx-patches + +--- + SPECS/python-docker.spec | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/SPECS/python-docker.spec b/SPECS/python-docker.spec +index 92420e3..9a05819 100644 +--- a/SPECS/python-docker.spec ++++ b/SPECS/python-docker.spec +@@ -29,6 +29,7 @@ Source0: https://files.pythonhosted.org/packages/source/d/%{srcname}/%{sr + # work in RHEL. This patch converts those environment markers into simple if + # statements. + Patch1: remove-environment-markers.patch ++Patch2: 0001-Update-client-close-socket.patch + + BuildArch: noarch + +@@ -138,7 +139,9 @@ run containers, manage containers, manage Swarms, etc. + %endif # with_python3 + + %prep +-%autosetup -n %{srcname}-%{version} -p 1 ++%setup -q -n %{srcname}-%{version} ++%patch2 -p1 ++ + rm -fr docker.egg-info + + %build +-- +1.8.3.1 + diff --git a/docker/python-docker/centos/meta_patches/PATCH_ORDER b/docker/python-docker/centos/meta_patches/PATCH_ORDER new file mode 100644 index 000000000..238975b92 --- /dev/null +++ b/docker/python-docker/centos/meta_patches/PATCH_ORDER @@ -0,0 +1,2 @@ +0001-Add-package-versioning.patch +0002-Update-spec-include-stx-patches.patch diff --git a/docker/python-docker/centos/patches/0001-Update-client-close-socket.patch b/docker/python-docker/centos/patches/0001-Update-client-close-socket.patch new file mode 100644 index 000000000..bbd67d8e7 --- /dev/null +++ b/docker/python-docker/centos/patches/0001-Update-client-close-socket.patch @@ -0,0 +1,28 @@ +From cbe001760e9893015b1576cba05ebce0938038e4 Mon Sep 17 00:00:00 2001 +From: John Kung +Date: Wed, 7 Aug 2019 14:06:04 -0400 +Subject: [PATCH 1/1] Update client close socket + +--- + docker/api/client.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/docker/api/client.py b/docker/api/client.py +index 13c292a..7df5eb1 100644 +--- a/docker/api/client.py ++++ b/docker/api/client.py +@@ -370,7 +370,10 @@ class APIClient( + if stream: + return gen + else: +- return six.binary_type().join(gen) ++ try: ++ return six.binary_type().join(gen) ++ finally: ++ response.close() + + def _disable_socket_timeout(self, socket): + """ Depending on the combination of python version and whether we're +-- +1.8.3.1 + diff --git a/docker/python-docker/centos/srpm_path b/docker/python-docker/centos/srpm_path new file mode 100644 index 000000000..e6e872ca1 --- /dev/null +++ b/docker/python-docker/centos/srpm_path @@ -0,0 +1 @@ +mirror:Source/python-docker-3.3.0-1.el7.src.rpm