[Python-modules-commits] r24326 - in packages/pyzmq/trunk/debian (3 files)
jtaylor-guest at users.alioth.debian.org
jtaylor-guest at users.alioth.debian.org
Sun May 12 21:52:55 UTC 2013
Date: Sunday, May 12, 2013 @ 21:52:53
Author: jtaylor-guest
Revision: 24326
workaround-gevent.patch: workaround issue with gevent < 1.0
Added:
packages/pyzmq/trunk/debian/patches/series
packages/pyzmq/trunk/debian/patches/workaround-gevent.patch
Modified:
packages/pyzmq/trunk/debian/changelog
Modified: packages/pyzmq/trunk/debian/changelog
===================================================================
--- packages/pyzmq/trunk/debian/changelog 2013-05-12 21:52:48 UTC (rev 24325)
+++ packages/pyzmq/trunk/debian/changelog 2013-05-12 21:52:53 UTC (rev 24326)
@@ -2,6 +2,7 @@
* New upstream release built with zeromq3 (Closes: #698830)
- drop all patches
+ * workaround-gevent.patch: workaround issue with gevent < 1.0
-- Julian Taylor <jtaylor.debian at googlemail.com> Sun, 12 May 2013 13:59:20 +0200
Added: packages/pyzmq/trunk/debian/patches/series
===================================================================
--- packages/pyzmq/trunk/debian/patches/series (rev 0)
+++ packages/pyzmq/trunk/debian/patches/series 2013-05-12 21:52:53 UTC (rev 24326)
@@ -0,0 +1 @@
+workaround-gevent.patch
Added: packages/pyzmq/trunk/debian/patches/workaround-gevent.patch
===================================================================
--- packages/pyzmq/trunk/debian/patches/workaround-gevent.patch (rev 0)
+++ packages/pyzmq/trunk/debian/patches/workaround-gevent.patch 2013-05-12 21:52:53 UTC (rev 24326)
@@ -0,0 +1,51 @@
+Description: add explicit poll interval in zmq.green
+ workaround same gevent FD bug in the sockets.
+ These workarounds can be removed when gevent finally releases 1.0
+Origin: https://github.com/zeromq/pyzmq/pull/372
+Author: Min RK <benjaminrk at gmail.com>
+Bug: https://github.com/zeromq/pyzmq/issues/370
+
+--- a/zmq/green/poll.py
++++ b/zmq/green/poll.py
+@@ -11,6 +11,7 @@ class _Poller(_original_Poller):
+ Ensures that the greened Poller below is used in calls to
+ :meth:`zmq.core.Poller.poll`.
+ """
++ _gevent_bug_timeout = 1.33 # minimum poll interval, for working around gevent bug
+
+ def _get_descriptors(self):
+ """Returns three elements tuple with socket descriptors ready
+@@ -73,7 +74,16 @@ class _Poller(_original_Poller):
+ return events
+
+ # wait for activity on sockets in a green way
+- select.select(rlist, wlist, xlist)
++ # set a minimum poll frequency,
++ # because gevent < 1.0 cannot be trusted to catch edge-triggered FD events
++ _bug_timeout = gevent.Timeout.start_new(self._gevent_bug_timeout)
++ try:
++ select.select(rlist, wlist, xlist)
++ except gevent.Timeout as t:
++ if t is not _bug_timeout:
++ raise
++ finally:
++ _bug_timeout.cancel()
+
+ except gevent.Timeout as t:
+ if t is not tout:
+--- a/zmq/tests/test_device.py
++++ b/zmq/tests/test_device.py
+@@ -148,10 +148,10 @@ if have_gevent:
+ g = gevent.spawn(zmq.green.device, zmq.QUEUE, rep, rep)
+ req.connect('tcp://127.0.0.1:%i' % port)
+ req.send(b'hi')
+- timeout = gevent.Timeout(1)
++ timeout = gevent.Timeout(3)
+ timeout.start()
+ receiver = gevent.spawn(req.recv)
+- self.assertEqual(receiver.get(1), b'hi')
++ self.assertEqual(receiver.get(2), b'hi')
+ timeout.cancel()
+- g.kill()
++ g.kill(block=True)
+
More information about the Python-modules-commits
mailing list