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 <alyson.deivespereira@windriver.com>
This commit is contained in:
Alyson Deives Pereira 2024-04-10 16:30:02 -03:00
parent 103fba5aee
commit d98e4cd9d0
5 changed files with 65 additions and 0 deletions

View File

@ -372,6 +372,9 @@ python3-setuptools
#python3.9
python3.9
#pyzmq
python3-zmq
#openscap
libopenscap25
openscap-common

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,53 @@
From b24e217033d40fd675f1a386e566665b8439266e Mon Sep 17 00:00:00 2001
From: Alyson Deives Pereira <alyson.deivespereira@windriver.com>
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 <alyson.deivespereira@windriver.com>
---
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

View File

@ -0,0 +1 @@
0001-Use-green-zmq.Context-from-eventlet-if-it-has-been-m.patch