From d98e4cd9d079bf9ea246bad07c27fdda66ba277b Mon Sep 17 00:00:00 2001 From: Alyson Deives Pereira Date: Wed, 10 Apr 2024 16:30:02 -0300 Subject: [PATCH] Add patched pyzmq debian package This change patches zmq GarbageCollector to use zmq.Context() from eventlet.green instead of default zmq.Context(). It was identified that sysinv-agent process was hanged. It was blocked on zmq garbage collector recv() call. Replacing the Garbage Collector to use the green Context solves the issue. Test Plan: PASS: Build package with build-pkgs -p pyzmq PASS: Build ISO PASS: Install on lab, configure ACC100, backup system PASS: Reinstall and restore system, then host-unlock Closes-Bug: 2060867 Change-Id: I229a8a4c70ebb4d7056fa2ff60bfc910bf12b257 Signed-off-by: Alyson Deives Pereira --- debian_iso_image.inc | 3 ++ debian_pkg_dirs | 1 + python/python3-zmq/debian/meta_data.yaml | 7 +++ ...ntext-from-eventlet-if-it-has-been-m.patch | 53 +++++++++++++++++++ python/python3-zmq/debian/patches/series | 1 + 5 files changed, 65 insertions(+) create mode 100644 python/python3-zmq/debian/meta_data.yaml create mode 100644 python/python3-zmq/debian/patches/0001-Use-green-zmq.Context-from-eventlet-if-it-has-been-m.patch create mode 100644 python/python3-zmq/debian/patches/series diff --git a/debian_iso_image.inc b/debian_iso_image.inc index a01cd9d0c..00e88f8ec 100644 --- a/debian_iso_image.inc +++ b/debian_iso_image.inc @@ -372,6 +372,9 @@ python3-setuptools #python3.9 python3.9 +#pyzmq +python3-zmq + #openscap libopenscap25 openscap-common diff --git a/debian_pkg_dirs b/debian_pkg_dirs index 09730ff5c..36c5335f6 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -96,6 +96,7 @@ python/dh-python python/python-nss python/python3-nsenter python/python3-setuptools +python/python3-zmq python/python3.9 python/zerorpc-python security/efitools diff --git a/python/python3-zmq/debian/meta_data.yaml b/python/python3-zmq/debian/meta_data.yaml new file mode 100644 index 000000000..9198a6399 --- /dev/null +++ b/python/python3-zmq/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: pyzmq +debver: 20.0.0-1 +archive: https://snapshot.debian.org/archive/debian/20240410T144822Z/pool/main/p/pyzmq/ +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true diff --git a/python/python3-zmq/debian/patches/0001-Use-green-zmq.Context-from-eventlet-if-it-has-been-m.patch b/python/python3-zmq/debian/patches/0001-Use-green-zmq.Context-from-eventlet-if-it-has-been-m.patch new file mode 100644 index 000000000..0191d7a47 --- /dev/null +++ b/python/python3-zmq/debian/patches/0001-Use-green-zmq.Context-from-eventlet-if-it-has-been-m.patch @@ -0,0 +1,53 @@ +From b24e217033d40fd675f1a386e566665b8439266e Mon Sep 17 00:00:00 2001 +From: Alyson Deives Pereira +Date: Wed, 10 Apr 2024 15:06:46 -0300 +Subject: [PATCH] Use green zmq.Context from eventlet if it has been + monkey-patched + +Make GarbageCollector aware of eventlet and verify it the Thread module +has been monkey-patched by eventlet. If that is the case, use zmq +.Context() from eventlet.green module. + +Signed-off-by: Alyson Deives Pereira +--- + docs/requirements.txt | 1 + + zmq/utils/garbage.py | 6 +++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/docs/requirements.txt b/docs/requirements.txt +index dfc9278..e30cd02 100644 +--- a/docs/requirements.txt ++++ b/docs/requirements.txt +@@ -1,4 +1,5 @@ + cython>=0.29 ++eventlet + gevent + pygments==2.4.2 + sphinx>=3.0.4 +diff --git a/zmq/utils/garbage.py b/zmq/utils/garbage.py +index d96bbd9..bb6b1ce 100644 +--- a/zmq/utils/garbage.py ++++ b/zmq/utils/garbage.py +@@ -11,7 +11,7 @@ import struct + + from os import getpid + from collections import namedtuple +-from threading import Thread, Event, Lock ++from threading import Thread, Event, Lock, current_thread + import warnings + + import zmq +@@ -95,6 +95,10 @@ class GarbageCollector(object): + # gevent has monkey-patched Thread, use green Context + from zmq import green + self._context = green.Context() ++ elif current_thread.__module__.startswith('eventlet'): ++ # eventlet has monkey-patched Thread, use green Context ++ from eventlet.green import zmq ++ self._context = zmq.Context() + else: + self._context = zmq.Context() + return self._context +-- +2.34.1 + diff --git a/python/python3-zmq/debian/patches/series b/python/python3-zmq/debian/patches/series new file mode 100644 index 000000000..2afe7fa52 --- /dev/null +++ b/python/python3-zmq/debian/patches/series @@ -0,0 +1 @@ +0001-Use-green-zmq.Context-from-eventlet-if-it-has-been-m.patch