Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Dear release team,
Please unblock package python-amqp,

Indeed, my last upload contains the backport of a very important
upstream patch. Without it, OpenStack user may experience:

MessagingTimeout: Timed out waiting for a reply to message ID 
ae039d1695984addbfaaef032ce4fda3

if using RabbitMQ over TLS. I've experienced this myself, this
isn't fun at all.

The patch is rather minimalistic (ie: just 2 lines of code, if
you don't include the fix of the test suite).

Debdiff attached,
Cheers,

Thomas Goirand (zigo)

unblock python-amqp/2.4.0-2
diff -Nru python-amqp-2.4.0/debian/changelog python-amqp-2.4.0/debian/changelog
--- python-amqp-2.4.0/debian/changelog  2019-01-22 15:29:00.000000000 +0100
+++ python-amqp-2.4.0/debian/changelog  2019-05-17 14:26:02.000000000 +0200
@@ -1,3 +1,11 @@
+python-amqp (2.4.0-2) unstable; urgency=medium
+
+  * Add Always_treat_SSLError_timeouts_as_socket_timeouts.patch, which fixes
+    MessagingTimeout: Timed out waiting for a reply to message ID <ID> in
+    OpenStack (and other users).
+
+ -- Thomas Goirand <z...@debian.org>  Fri, 17 May 2019 14:26:02 +0200
+
 python-amqp (2.4.0-1) unstable; urgency=medium
 
   [ Ondřej Nový ]
diff -Nru 
python-amqp-2.4.0/debian/patches/Always_treat_SSLError_timeouts_as_socket_timeouts.patch
 
python-amqp-2.4.0/debian/patches/Always_treat_SSLError_timeouts_as_socket_timeouts.patch
--- 
python-amqp-2.4.0/debian/patches/Always_treat_SSLError_timeouts_as_socket_timeouts.patch
    1970-01-01 01:00:00.000000000 +0100
+++ 
python-amqp-2.4.0/debian/patches/Always_treat_SSLError_timeouts_as_socket_timeouts.patch
    2019-05-17 14:26:02.000000000 +0200
@@ -0,0 +1,63 @@
+Description: Always treat SSLError timeouts as socket timeouts (#247)
+ Without specifically handling this case, the socket.timeout()
+ was not raised sometimes causing the connection to lock up.
+ .
+ In the case we hit the errno was None, so the previous if
+ condition did not apply.
+Author: Dirk Mueller <dmuel...@suse.com>
+Date: Thu, 31 Jan 2019 15:07:26 +0100
+Co-Authored-By: aojeagarcia <aojeagar...@suse.com>
+Origin: upstream, 
https://github.com/celery/py-amqp/commit/bf122a05a21a8cc5bca314b0979f32c8026fc66e.patch
+Last-Update: 2019-05-17
+
+Index: python-amqp/amqp/transport.py
+===================================================================
+--- python-amqp.orig/amqp/transport.py
++++ python-amqp/amqp/transport.py
+@@ -374,6 +374,10 @@ class SSLTransport(_AbstractTransport):
+                 try:
+                     s = recv(n - len(rbuf))  # see note above
+                 except socket.error as exc:
++                    # ssl.sock.read may cause a SSLerror without errno
++                    # http://bugs.python.org/issue10272
++                    if isinstance(exc, SSLError) and 'timed out' in str(exc):
++                        raise socket.timeout()
+                     # ssl.sock.read may cause ENOENT if the
+                     # operation couldn't be performed (Issue celery#1414).
+                     if exc.errno in _errnos:
+Index: python-amqp/t/unit/test_transport.py
+===================================================================
+--- python-amqp.orig/t/unit/test_transport.py
++++ python-amqp/t/unit/test_transport.py
+@@ -4,7 +4,7 @@ import errno
+ import socket
+ 
+ import pytest
+-from case import ANY, Mock, call, patch
++from case import ANY, Mock, MagicMock, call, patch
+ 
+ from amqp import transport
+ from amqp.exceptions import UnexpectedFrame
+@@ -600,6 +600,22 @@ class test_SSLTransport:
+                            match=r'.*Server unexpectedly closed 
connection.*'):
+             self.t._read(64)
+ 
++    def test_read_timeout(self):
++        self.t.sock = Mock(name='SSLSocket')
++        self.t._quick_recv = Mock(name='recv', return_value='4')
++        self.t._quick_recv.side_effect = socket.timeout()
++        self.t._read_buffer = MagicMock(return_value='AA')
++        with pytest.raises(socket.timeout):
++            self.t._read(64)
++
++    def test_read_SSLError(self):
++        self.t.sock = Mock(name='SSLSocket')
++        self.t._quick_recv = Mock(name='recv', return_value='4')
++        self.t._quick_recv.side_effect = transport.SSLError('timed out')
++        self.t._read_buffer = MagicMock(return_value='AA')
++        with pytest.raises(socket.timeout):
++            self.t._read(64)
++
+ 
+ class test_TCPTransport:
+ 
diff -Nru python-amqp-2.4.0/debian/patches/series 
python-amqp-2.4.0/debian/patches/series
--- python-amqp-2.4.0/debian/patches/series     2019-01-22 15:29:00.000000000 
+0100
+++ python-amqp-2.4.0/debian/patches/series     2019-05-17 14:26:02.000000000 
+0200
@@ -1,3 +1,4 @@
 0001-Remove-PayPal-image-URLs.patch
 0002-Disable-intersphinx-mapping-for-now.patch
 0010-remove-broken-test.patch
+Always_treat_SSLError_timeouts_as_socket_timeouts.patch

Reply via email to