Merge lp:~hopem/ubuntu/trusty/python-amqp/lp1472712 into lp:ubuntu/trusty/python-amqp

Proposed by Edward Hope-Morley
Status: Rejected
Rejected by: Brian Murray
Proposed branch: lp:~hopem/ubuntu/trusty/python-amqp/lp1472712
Merge into: lp:ubuntu/trusty/python-amqp
Diff against target: 82 lines (+64/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/dont-disconnect-transport-on-ssl-read-timeout.patch (+56/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~hopem/ubuntu/trusty/python-amqp/lp1472712
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+267205@code.launchpad.net
To post a comment you must log in.
5. By Edward Hope-Morley

[hopem,r=]

* Backport patch from 1.4.4 to ensure SSL timeouts raised properly (LP: #1472712)
  - d/p/dont-disconnect-transport-on-ssl-read-timeout.patch

Revision history for this message
Brian Murray (brian-murray) wrote :

Merged doesn't seem like the right status as the bzr branch hasn't been, but it seems that the same fix was uploaded to trusty-proposed (see bug 1472712) so I'm setting this to Rejected.

Unmerged revisions

5. By Edward Hope-Morley

[hopem,r=]

* Backport patch from 1.4.4 to ensure SSL timeouts raised properly (LP: #1472712)
  - d/p/dont-disconnect-transport-on-ssl-read-timeout.patch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-01-07 20:32:33 +0000
3+++ debian/changelog 2015-08-06 17:06:17 +0000
4@@ -1,3 +1,10 @@
5+python-amqp (1.3.3-1ubuntu2) trusty; urgency=medium
6+
7+ * Backport patch from 1.4.4 to ensure SSL timeouts raised properly (LP: #1472712)
8+ - d/p/dont-disconnect-transport-on-ssl-read-timeout.patch
9+
10+ -- Edward Hope-Morley <edward.hope-morley@canonical.com> Thu, 06 Aug 2015 15:17:01 +0100
11+
12 python-amqp (1.3.3-1ubuntu1) trusty; urgency=medium
13
14 * Merge with Debian; remaining changes:
15
16=== added file 'debian/patches/dont-disconnect-transport-on-ssl-read-timeout.patch'
17--- debian/patches/dont-disconnect-transport-on-ssl-read-timeout.patch 1970-01-01 00:00:00 +0000
18+++ debian/patches/dont-disconnect-transport-on-ssl-read-timeout.patch 2015-08-06 17:06:17 +0000
19@@ -0,0 +1,56 @@
20+From 435c12777702be2a36c96006ea1880a6e051d943 Mon Sep 17 00:00:00 2001
21+From: Craig Jellick <cjellick@godaddy.com>
22+Date: Wed, 26 Feb 2014 13:12:18 -0700
23+Subject: [PATCH] Don't disconnect transport on SSL read timeout
24+
25+SSL socket read timeouts are not raised as socket.timeout exceptions.
26+So, to have SSL socket read timeouts behave the same way as TCP socket
27+read timeouts, we need to find them based off of their text and reraise
28+as socket.timeout exceptions.
29+
30+This is similar to the fix in read_timeout in connection.py at:
31+https://github.com/celery/py-amqp/blob/1.4/amqp/connection.py#L336-L337
32+and in fact the exception raised here is eventually caught by
33+read_timeout and replaced with a socket.timeout exception. The problem
34+is that the transport is already marked as disconnected at that point.
35+So, we need to catch the timeout here in transport.py
36+---
37+ amqp/transport.py | 11 +++++++++++
38+ 1 file changed, 11 insertions(+)
39+
40+Index: python-amqp-1.3.3/amqp/transport.py
41+===================================================================
42+--- python-amqp-1.3.3.orig/amqp/transport.py 2015-08-06 15:20:04.927963910 +0100
43++++ python-amqp-1.3.3/amqp/transport.py 2015-08-06 15:20:04.923963909 +0100
44+@@ -46,6 +46,12 @@
45+ # Python 2.5 and lower
46+ bytes = str
47+
48++try:
49++ from ssl import SSLError
50++except ImportError:
51++ class SSLError(Exception): # noqa
52++ pass
53++
54+ from struct import pack, unpack
55+
56+ from .exceptions import UnexpectedFrame
57+@@ -166,6 +172,10 @@
58+ except socket.timeout:
59+ raise
60+ except (OSError, IOError, socket.error) as exc:
61++ # Don't disconnect for ssl read time outs
62++ # http://bugs.python.org/issue10272
63++ if isinstance(exc, SSLError) and 'timed out' in str(exc):
64++ raise socket.timeout()
65+ if get_errno(exc) not in _UNAVAIL:
66+ self.connected = False
67+ raise
68+@@ -258,6 +268,7 @@
69+ s = s[n:]
70+
71+
72++
73+ class TCPTransport(_AbstractTransport):
74+ """Transport that deals directly with TCP socket."""
75+
76
77=== modified file 'debian/patches/series'
78--- debian/patches/series 2013-11-06 08:38:39 +0000
79+++ debian/patches/series 2015-08-06 17:06:17 +0000
80@@ -1,1 +1,2 @@
81 01_drop_issuetracker.patch
82+dont-disconnect-transport-on-ssl-read-timeout.patch

Subscribers

People subscribed via source and target branches