[python-qpid] Avoid use of poll if select is monkey patched by Eventlet/Greenthreads

Darryl L. Pierce mcpierce at fedoraproject.org
Mon Jul 7 15:29:54 UTC 2014


commit 8a60a03001180d1b30d2633986924571750a7a0e
Author: Darryl L. Pierce <mcpierce at gmail.com>
Date:   Mon Jul 7 11:29:59 2014 -0400

    Avoid use of poll if select is monkey patched by Eventlet/Greenthreads
    
    - Resolves: BZ#1109488

 ...void-use-of-poll-if-select-is-monkey-patc.patch |   39 ++++++++++++++++++++
 python-qpid.spec                                   |    8 ++++-
 2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/0001-QPID-5790-avoid-use-of-poll-if-select-is-monkey-patc.patch b/0001-QPID-5790-avoid-use-of-poll-if-select-is-monkey-patc.patch
new file mode 100644
index 0000000..7efb61b
--- /dev/null
+++ b/0001-QPID-5790-avoid-use-of-poll-if-select-is-monkey-patc.patch
@@ -0,0 +1,39 @@
+From 747c66adaa417eb18485a2032b7d27ac23094896 Mon Sep 17 00:00:00 2001
+From: Ken Giusti <kgiusti at apache.org>
+Date: Fri, 30 May 2014 13:08:23 +0000
+Subject: [PATCH] QPID-5790: avoid use of poll if select is monkey-patched by
+ Eventlet/Greenthreads
+
+git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1598586 13f79535-47bb-0310-9956-ffa450edef68
+---
+ qpid/python/qpid/compat.py | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/qpid/python/qpid/compat.py b/qpid/python/qpid/compat.py
+index 1fad902..12966c2 100644
+--- a/qpid/python/qpid/compat.py
++++ b/qpid/python/qpid/compat.py
+@@ -40,10 +40,18 @@ except ImportError:
+   def format_exc():
+     return "".join(traceback.format_exception(*sys.exc_info()))
+ 
+-# prefer poll() to select(), as it performs better at scale:
++# QPID-5588: prefer poll() to select(), as it allows file descriptors with
++# values > FD_SETSIZE
+ import select as _select_mod
+-if hasattr(_select_mod, "poll"):
++try:
++  # QPID-5790: unless eventlet/greenthreads have monkey-patched the select
++  # module, as to date poll() is not properly supported by eventlet
++  import eventlet
++  _is_patched = eventlet.patcher.is_monkey_patched("select")
++except ImportError:
++  _is_patched = False
+ 
++if hasattr(_select_mod, "poll") and not _is_patched:
+   from select import error as SelectError
+   def select(rlist, wlist, xlist, timeout=None):
+     fd_count = 0
+-- 
+1.9.3
+
diff --git a/python-qpid.spec b/python-qpid.spec
index e85835a..8def42c 100644
--- a/python-qpid.spec
+++ b/python-qpid.spec
@@ -3,12 +3,13 @@
 
 Name:           python-qpid
 Version:        0.28
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Python client library for AMQP
 
 License:        ASL 2.0
 URL:            http://qpid.apache.org
 Source0:        http://www.apache.org/dyn/closer.cgi/qpid/%{version}/qpid-python-%{version}.tar.gz
+Patch0001:      0001-QPID-5790-avoid-use-of-poll-if-select-is-monkey-patc.patch
 
 BuildArch:      noarch
 
@@ -39,6 +40,7 @@ Summary:   Shared code for Qpid Python language bindings
 
 %prep
 %setup -q -n qpid-python-%{version}
+%patch0001 -p3
 cd ..
 
 %build
@@ -70,6 +72,10 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %changelog
+* Mon Jul  7 2014 Darryl L. Pierce <dpierce at redhat.com> - 0.28-3
+- Avoid use of poll if select is monkey patched by Eventlet/Greenthreads
+- Resolves: BZ#1109488
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.28-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list