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 <john.kung@windriver.com>
This commit is contained in:
John Kung 2019-08-09 09:49:41 -04:00
parent bfb2d7a08b
commit 3f4a439109
7 changed files with 93 additions and 0 deletions

View File

@ -83,6 +83,7 @@ kernel/kernel-modules/mlnx-ofa_kernel
networking/mellanox/rdma-core networking/mellanox/rdma-core
monitoring/collectd-extensions monitoring/collectd-extensions
monitoring/influxdb-extensions monitoring/influxdb-extensions
docker/python-docker
kubernetes/kubernetes kubernetes/kubernetes
kubernetes/docker-distribution kubernetes/docker-distribution
kubernetes/etcd kubernetes/etcd

View File

@ -0,0 +1 @@
TIS_PATCH_VER=1

View File

@ -0,0 +1,25 @@
From 9bc57c6963fcea63a7793633339e5692ec3e2252 Mon Sep 17 00:00:00 2001
From: John Kung <john.kung@windriver.com>
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

View File

@ -0,0 +1,35 @@
From a0c3f898cabd79b07cc6cc52245de712ee7b46bd Mon Sep 17 00:00:00 2001
From: John Kung <john.kung@windriver.com>
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

View File

@ -0,0 +1,2 @@
0001-Add-package-versioning.patch
0002-Update-spec-include-stx-patches.patch

View File

@ -0,0 +1,28 @@
From cbe001760e9893015b1576cba05ebce0938038e4 Mon Sep 17 00:00:00 2001
From: John Kung <john.kung@windriver.com>
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

View File

@ -0,0 +1 @@
mirror:Source/python-docker-3.3.0-1.el7.src.rpm