Bug 1305127

Summary: Swift Proxy Server Unable to Connect to memcached Over IPv6
Product: Red Hat OpenStack Reporter: Keith Basil <kbasil>
Component: openstack-swiftAssignee: Pete Zaitcev <zaitcev>
Status: CLOSED ERRATA QA Contact: Mike Abrams <mabrams>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0 (Liberty)CC: derekh, dsneddon, jpena, kbasil, nlevinki, scohen, sgotliv, srevivo, zaitcev
Target Milestone: ---Keywords: Triaged, ZStream
Target Release: 8.0 (Liberty)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-swift-2.5.0-3.el7ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1305071 Environment:
Last Closed: 2016-10-26 13:42:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1305071    
Bug Blocks:    

Comment 1 Keith Basil 2016-02-05 18:10:46 UTC
Cloned for OSP 8.

Comment 2 Dan Sneddon 2016-02-06 12:22:33 UTC
This seems to be caused by an IPv4-centric connection method in /usr/lib/python2.7/site-packages/swift/common/memcached.py

This seems to fix the issue:

    119     def create(self):
    120         if ']' in self.server:
    121             # deconstruct ipv6 address in brackets
    122             server_uri = self.server.strip("[").split("]")
    123             host = server_uri[0]
    124             if len(server_uri) > 1:
    125                 port = server_uri[1].strip(":")
    126             else:
    127                 port = DEFAULT_MEMCACHED_PORT
    128         elif ':' in self.server:
    129             host, port = self.server.split(':')
    130         else:
    131             host = self.server
    132             port = DEFAULT_MEMCACHED_PORT
    133         if ":" in host:
    134             sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
    135         else:
    136             sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    137         sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
    138         with Timeout(self._connect_timeout):
    139             sock.connect((host, int(port)))
    140         return (sock.makefile(), sock)

Comment 3 Javier Peña 2016-03-03 12:30:29 UTC
The upstream bug is https://bugs.launchpad.net/swift/+bug/1526570 . It has been handled in Mitaka by a series of patches:

- https://review.openstack.org/258704 Fix IPv6 handling in MemcacheConnPool.
- https://review.openstack.org/265482 fixups for ipv6 memcache_servers docs
- https://review.openstack.org/265465 Fail early if the memcache address is invalid.
- https://review.openstack.org/265501 Make _get_addr() method a function in utils.

On a quick test, they apply (almost) flawlessly to stable/liberty, so I think it would be feasible to backport them.

Comment 7 Sergey Gotliv 2016-04-07 05:25:57 UTC
This  is not blocker for 8.0 GA, will be fixed in the first async.

Comment 16 errata-xmlrpc 2016-10-26 13:42:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2114.html