Memcached connections growing beyond max_memcache_connections parameter

Bug #1235027 reported by Peter Portante
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
High
Unassigned

Bug Description

As of https://review.openstack.org/45134, pooled memcache connections is supposed to be working. But after running a number of tests, the number of memcache connections is much more than the default of 2:

[pportant@dhcp31-22 ~]$ lsof -a -d 1-99999 -p 7959
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
swift-pro 7959 pportant 1u CHR 1,3 0t0 4942 /dev/null
swift-pro 7959 pportant 2u CHR 1,3 0t0 4942 /dev/null
swift-pro 7959 pportant 3u unix 0xffff8800058eee00 0t0 523001 socket
swift-pro 7959 pportant 4u IPv4 523002 0t0 TCP *:webcache (LISTEN)
swift-pro 7959 pportant 6u unix 0xffff880025cd4380 0t0 523067 socket
swift-pro 7959 pportant 7u unix 0xffff88003c1dae00 0t0 523072 socket
swift-pro 7959 pportant 8u unix 0xffff88003c1db880 0t0 523073 socket
swift-pro 7959 pportant 9u unix 0xffff88003c1dbc00 0t0 523080 socket
swift-pro 7959 pportant 10u unix 0xffff88003c1db500 0t0 523081 socket
swift-pro 7959 pportant 11u unix 0xffff880034e86a80 0t0 523071 socket
swift-pro 7959 pportant 12u IPv4 523626 0t0 TCP localhost:41859->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 14u IPv4 545103 0t0 TCP localhost:48649->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 15u IPv4 545105 0t0 TCP localhost:48650->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 16u IPv4 545112 0t0 TCP localhost:48653->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 17u IPv4 545110 0t0 TCP localhost:48652->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 18u IPv4 545132 0t0 TCP localhost:48660->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 19u IPv4 545134 0t0 TCP localhost:48661->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 20u IPv4 545136 0t0 TCP localhost:48662->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 21u IPv4 545138 0t0 TCP localhost:48663->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 22u IPv4 545173 0t0 TCP localhost:48672->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 23u IPv4 545143 0t0 TCP localhost:48665->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 24u IPv4 545180 0t0 TCP localhost:48673->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 26u IPv4 545185 0t0 TCP localhost:48675->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 325u IPv4 546078 0t0 TCP localhost:48976->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 326u IPv4 546080 0t0 TCP localhost:48977->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 327u IPv4 546082 0t0 TCP localhost:48978->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 328u IPv4 546084 0t0 TCP localhost:48979->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 329u IPv4 546086 0t0 TCP localhost:48980->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 330u IPv4 546088 0t0 TCP localhost:48981->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 331u IPv4 546090 0t0 TCP localhost:48982->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 332u IPv4 546092 0t0 TCP localhost:48983->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 333u IPv4 546094 0t0 TCP localhost:48984->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 334u IPv4 546096 0t0 TCP localhost:48985->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 335u IPv4 546098 0t0 TCP localhost:48986->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 685u IPv4 537750 0t0 TCP localhost:46264->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 731u IPv4 543256 0t0 TCP localhost:48110->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 732u IPv4 543258 0t0 TCP localhost:48111->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 734u IPv4 543262 0t0 TCP localhost:48113->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 735u IPv4 543264 0t0 TCP localhost:48114->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 736u IPv4 543266 0t0 TCP localhost:48115->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 737u IPv4 543268 0t0 TCP localhost:48116->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 744u IPv4 543283 0t0 TCP localhost:48123->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 745u IPv4 543285 0t0 TCP localhost:48124->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 746u IPv4 543287 0t0 TCP localhost:48125->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 748u IPv4 543291 0t0 TCP localhost:48127->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 749u IPv4 543293 0t0 TCP localhost:isnetserv->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 750u IPv4 543295 0t0 TCP localhost:blp5->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 753u IPv4 543301 0t0 TCP localhost:48132->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 755u IPv4 543305 0t0 TCP localhost:48134->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 756u IPv4 543307 0t0 TCP localhost:48135->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 759u IPv4 543313 0t0 TCP localhost:48138->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 760u IPv4 543315 0t0 TCP localhost:48139->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 762u IPv4 543319 0t0 TCP localhost:48141->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 764u IPv4 543323 0t0 TCP localhost:48143->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 767u IPv4 543329 0t0 TCP localhost:48146->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 770u IPv4 543336 0t0 TCP localhost:48149->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 772u IPv4 543340 0t0 TCP localhost:48151->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 774u IPv4 543344 0t0 TCP localhost:48153->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 775u IPv4 543346 0t0 TCP localhost:48154->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 777u IPv4 543350 0t0 TCP localhost:48156->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 778u IPv4 543352 0t0 TCP localhost:48157->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 780u IPv4 543356 0t0 TCP localhost:48159->localhost:memcache (ESTABLISHED)
swift-pro 7959 pportant 781u IPv4 543358 0t0 TCP localhost:48160->localhost:memcache (ESTABLISHED)

Run on a Fedora 19 SAIO using the patched code for https://review.openstack.org/48538, Sam Merrit's client disconnect fix.

Changed in swift:
milestone: none → 1.9.3-rc1
importance: Undecided → High
Changed in swift:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.openstack.org/49739
Committed: http://github.com/openstack/swift/commit/6607beab0dc8043251b490471761fa2dd85f2816
Submitter: Jenkins
Branch: master

commit 6607beab0dc8043251b490471761fa2dd85f2816
Author: Peter Portante <email address hidden>
Date: Fri Oct 4 08:04:42 2013 -0400

    Don't apply timeout to Pool.get operation (leaks)

    The connection timeout to a memcache server is performed by using the
    "with Timeout()" construct over the sock.connect() call in the
    .create() method. In addition, the same construct was being applied to
    the Pool.get() call in ._get_conns().

    If the maximum number of connections was already created, and the
    Pool.get() called took longer than the connect timeout, then the error
    handling path would add a place holder to the connection
    pool. Eventlet's Pool class allows for additional items to be added to
    the pool, over and above the max_size setting. This additional place
    holder will eventually be pulled and a new connection created to take
    its place.

    The fix is to remove the timeout construct in the _get_conns() method.

    In addition, we also apply the unit test patch mentioned in the review
    comments for Patch Set 6 of https://review.openstack.org/45134,
    located at http://paste.openstack.org/show/47288/.

    Fixes bug 1235027

    Change-Id: I786cabefe3e8ddf7d92feb7ebc7cfb613d60a1da
    Signed-off-by: Peter Portante <email address hidden>

Changed in swift:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in swift:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in swift:
milestone: 1.10.0-rc1 → 1.10.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (feature/ec)

Fix proposed to branch: feature/ec
Review: https://review.openstack.org/54029

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (feature/ec)
Download full text (24.9 KiB)

Reviewed: https://review.openstack.org/54029
Committed: http://github.com/openstack/swift/commit/94d3671b0bbf87fdbff845643963f3f9a97c58b5
Submitter: Jenkins
Branch: feature/ec

commit abcecd26a7b5871f75f0fbddf0d08bbac95bb089
Author: Kun Huang <email address hidden>
Date: Wed Oct 23 21:19:01 2013 +0800

    utf8 encode tempurl key

    In tempurl middleware, hmac uses the value of account metadata to
    generate HMAC-SHA1 signature and hmac must accept a str-type string, not
    a unicode string. The meta dict returned from get_info stroges special
    chars as unicode however. So just encode it for tempurl using.

    Closes-Bug: #1242644
    Change-Id: I4be62eea014a573efc4748470de57dccf00e431d

commit cd2e7df0b69bbd269cd3c4170e0fee8186a07c95
Author: Pete Zaitcev <email address hidden>
Date: Tue Oct 22 17:18:04 2013 -0600

    Add an __str__ method to brokers

    A few uses of broker.db_file are in printouts where we do need
    them, so the administrator may know what's up. Seems like an easy
    way to get rid of those is to make brokers identify themselves
    with common __str__. Alternative back-end implementations may
    supply something other than a filename here, for example a cluster
    name and a volume name.

    Note that I'm not sure if correct coercion would occur when
    brokers are bounced through dictionaries, hence explicit str().

    Change-Id: I329788ebd1fbe39ffadcf9f9d5194a74a88dde58

commit 9807a358c6d1314d25e3a41da75be5851fa0ac27
Author: Donagh McCabe <email address hidden>
Date: Fri Aug 23 15:03:08 2013 +0100

    Add WWW-Authenticate to 401 responses

    Per http://www.ietf.org/rfc/rfc2616.txt, when a 401 error is returned, the
    Www-Authenticate response header MUST also be returned. The format is
    described in http://www.ietf.org/rfc/rfc2617.txt.

    Swift supports and/or implements a number of authentication schemes
    including tempauth, Keystone, tempurl, formpost and container sync. In
    this fix, we use a catch-all, "Swift". The realm is the account (where
    known) or "unknown" (bad path or where the 401 is returned from code
    that does not have the request). Examples:

         Www-Authenticate: Swift realm="AUTH_1234567889"
         Www-Authenticate: Swift realm="unknown"

    Fixes bug #1215491

    Change-Id: I03362789318dfa156d3733ef9348795062a9cfc4

commit ed5101b2002b877518466ae5f9a6d652581238f2
Author: Yuan Zhou <email address hidden>
Date: Sat Oct 19 11:40:35 2013 +0800

    Adding more unit tests for audit_location_generator

    Change-Id: I40410fbbb79cea8647074f703e4675364c69d930

commit 5202b0e58613738cc81ec63e7c6da14ce5429526
Author: Peter Portante <email address hidden>
Date: Thu Sep 12 19:51:18 2013 -0400

    DiskFile API, with reference implementation

    Refactor on-disk knowledge out of the object server by pushing the
    async update pickle creation to the new DiskFileManager class (name is
    not the best, so suggestions welcome), along with the REPLICATOR
    method logic. We also move the mount checking and thread pool storage
    to the new ondisk.Devices object, which then also becomes th...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.