Crash with python-memcached==1.5.4

Bug #1440493 reported by Ondergetekende
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
High
Alexander Makarov
Kilo
Fix Released
High
Alexander Makarov
keystonemiddleware
Invalid
Undecided
Unassigned

Bug Description

There's some magic going on at line:
https://github.com/openstack/keystone/blob/2014.2.2/keystone/common/cache/_memcache_pool.py#L46

This magic is broken due to the fact that python-memcached added a super(...) initalization at
https://github.com/linsomniac/python-memcached/blob/master/memcache.py#L218
https://github.com/linsomniac/python-memcached/commit/45403325e0249ff0f61d6ae449a7daeeb7e852e5

Due to this change, keystone can no longer work with the latest python-memcached version:

Traceback (most recent call last):
  File ""keystone/common/wsgi.py", line 223, in __call__
    result = method(context, **params)
  File ""keystone/identity/controllers.py", line 76, in create_user
    self.assignment_api.get_project(default_project_id)
  File ""dogpile/cache/region.py", line 1040, in decorate
    should_cache_fn)
  File ""dogpile/cache/region.py", line 651, in get_or_create
    async_creator) as value:
  File ""dogpile/core/dogpile.py", line 158, in __enter__
    return self._enter()
  File ""dogpile/core/dogpile.py", line 91, in _enter
    value = value_fn()
  File ""dogpile/cache/region.py", line 604, in get_value
    value = self.backend.get(key)
  File ""dogpile/cache/backends/memcached.py", line 149, in get
    value = self.client.get(key)
  File ""keystone/common/cache/backends/memcache_pool.py", line 35, in _run_method
    with self.client_pool.acquire() as client:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File ""keystone/common/cache/_memcache_pool.py", line 97, in acquire
    conn = self.get(timeout=self._connection_get_timeout)
  File ""eventlet/queue.py", line 293, in get
    return self._get()
  File ""keystone/common/cache/_memcache_pool.py", line 155, in _get
    conn = ConnectionPool._get(self)
  File ""keystone/common/cache/_memcache_pool.py", line 120, in _get
    conn = self._create_connection()
  File ""keystone/common/cache/_memcache_pool.py", line 149, in _create_connection
    return _MemcacheClient(self.urls, **self._arguments)
  File ""memcache.py", line 228, in __init__
    super(Client, self).__init__()
TypeError: super(type, obj): obj must be an instance or subtype of type

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/170759

Changed in keystone:
assignee: nobody → Boris Bobrov (bbobrov)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on keystone (master)

Change abandoned by Boris Bobrov (<email address hidden>) on branch: master
Review: https://review.openstack.org/170759
Reason: in favor of https://review.openstack.org/170762

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/170835

Changed in keystone:
assignee: Boris Bobrov (bbobrov) → Alexander Makarov (amakarov)
summary: - Crash with python-memcached==1.54
+ Crash with python-memcached==1.5.4
tags: added: kilo-rc-potential
Changed in keystone:
importance: Undecided → High
Revision history for this message
Lin Hua Cheng (lin-hua-cheng) wrote :

If we get this patch in, we won't need to update the g-r for python-memcached.

Copying snippet from the patch discussion:
<stevemar>:
so, one more issue. Does this workaround (which works for python-memcached 1.5.4) work for older versions of python-memcached (1.5.3 or older).
If our current code relies on python-memcached 1.5.4 then we should change global requirements to have a minimum of 1.5.4.
<amakarov>:
Steve, the very purpose of this patch is to avoid the need to apply version restriction.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/170835
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=33a95575fc3778bf8ef054f7b9d24fcb7c75100b
Submitter: Jenkins
Branch: master

commit 33a95575fc3778bf8ef054f7b9d24fcb7c75100b
Author: Alexander Makarov <email address hidden>
Date: Mon Apr 6 15:49:41 2015 +0300

    Make memcache client reusable across threads

    memcache.Client is inherited from threading._local so instances are only
    accessible from current thread or eventlet. Present workaround broke
    inheritance chain so super() call is unusable.

    This patch makes artificial client class mimic inheritance from
    threading._local while using generic object methods allowing reusability.

    Change-Id: Ic5d5709695877afb995fd816bb0e4ce711b99b60
    Closes-Bug: #1440493

Changed in keystone:
status: In Progress → Fix Committed
Changed in keystone:
milestone: none → liberty-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/175291

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (stable/kilo)

Reviewed: https://review.openstack.org/175291
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=18ca7fabece4837ad56e435bc9d5f0b6278fa4be
Submitter: Jenkins
Branch: stable/kilo

commit 18ca7fabece4837ad56e435bc9d5f0b6278fa4be
Author: Alexander Makarov <email address hidden>
Date: Mon Apr 6 15:49:41 2015 +0300

    Make memcache client reusable across threads

    memcache.Client is inherited from threading._local so instances are only
    accessible from current thread or eventlet. Present workaround broke
    inheritance chain so super() call is unusable.

    This patch makes artificial client class mimic inheritance from
    threading._local while using generic object methods allowing reusability.

    Change-Id: Ic5d5709695877afb995fd816bb0e4ce711b99b60
    Closes-Bug: #1440493
    (cherry picked from commit 33a95575fc3778bf8ef054f7b9d24fcb7c75100b)

Thierry Carrez (ttx)
tags: removed: kilo-rc-potential
Thierry Carrez (ttx)
no longer affects: keystone/liberty
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/179288

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)
Download full text (4.7 KiB)

Reviewed: https://review.openstack.org/179288
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=9bc6043eb06199b8d4dbf6698e129d984a59cc11
Submitter: Jenkins
Branch: master

commit 65a50eebb8d0a53a2c4c226eb9a564c4d535ac68
Author: Brant Knudson <email address hidden>
Date: Wed Apr 22 11:33:00 2015 -0500

    Sync oslo-incubator Ie51669bd278288b768311ddf56ad31a2f28cc7ab

    This syncs to oslo-incubator to commit 64b5819 and also includes
    51280db.

    Change-Id: I7b43a67a0b67fe0ff5ac3d87708ecc4ab52102f8
    Depends-On: Ie51669bd278288b768311ddf56ad31a2f28cc7ab
    Closes-Bug: #1446583
    (cherry picked from commit 797da5f05444e7cfbf55df52867ade6107834f00)

commit 579a065c0dcce554a5dca86164eb8f1d6fb43c4d
Author: OpenStack Proposal Bot <email address hidden>
Date: Mon Apr 20 17:55:55 2015 +0000

    Updated from global requirements

    Change-Id: I72af7a36f2c3ba206be06fa35323386801e6ff81

commit 906485152a8ec886cf4a45cbe1037184ce39f1a1
Author: Andreas Jaeger <email address hidden>
Date: Mon Apr 20 11:11:25 2015 +0200

    Release Import of Translations from Transifex

    Manual import of Translations from Transifex. This change also removes
    all po files that are less than 66 per cent translated since such
    partially translated files will not help users.

    This change needs to be done manually since the automatic import does
    not handle the proposed branches and we need to sync with latest
    translations.

    Change-Id: Iaf4bdae303b06c1af4023fe2daa3a6b03c195ee9

commit 18ca7fabece4837ad56e435bc9d5f0b6278fa4be
Author: Alexander Makarov <email address hidden>
Date: Mon Apr 6 15:49:41 2015 +0300

    Make memcache client reusable across threads

    memcache.Client is inherited from threading._local so instances are only
    accessible from current thread or eventlet. Present workaround broke
    inheritance chain so super() call is unusable.

    This patch makes artificial client class mimic inheritance from
    threading._local while using generic object methods allowing reusability.

    Change-Id: Ic5d5709695877afb995fd816bb0e4ce711b99b60
    Closes-Bug: #1440493
    (cherry picked from commit 33a95575fc3778bf8ef054f7b9d24fcb7c75100b)

commit cedce339a08d475617c7f57c148e192dc3709a34
Author: Thierry Carrez <email address hidden>
Date: Thu Apr 16 22:19:42 2015 +0200

    Set default branch to stable/kilo

    Open stable/kilo branch by setting defaultbranch for git-review.

    Change-Id: If5b35b0fc5a85ba8dda16dc6b365537ed0d839bc

commit 86df39c01e96ad3b15e33eb6fc1bf726a0a704c5
Author: Eric Brown <email address hidden>
Date: Mon Apr 13 11:37:53 2015 -0700

    backend_argument should be marked secret

    Since the backend_argument can potentially contain a password,
    it should be marked secret to avoid leakage into the logs.

    Closes-Bug: #1443598

    Change-Id: I55663db4cf2df84a66de8f64fba4b4f129ae827d
    (cherry picked from commit f9db1a65bd4d83d12c572ba4d5807845996ef410)

commit b679e7d6be18d33ebdfe133161a3daf2f305d954
Author: Lance Bragstad <email address hidden>
Date: Tue Apr 7 18:47:34 2015 +0000

    Update man p...

Read more...

Changed in keystone:
status: Fix Committed → Fix Released
Revision history for this message
Choe, Cheng-Dae (whitekid) wrote :

Would you backport to juno?

Thierry Carrez (ttx)
Changed in keystone:
milestone: liberty-1 → 8.0.0
Revision history for this message
Steve Martinelli (stevemar) wrote :

marking as invalid for ksm, we have python-memcached>=1.5.6 as of mitaka

Changed in keystonemiddleware:
status: New → Invalid
Revision history for this message
Jeffrey Zhang (jeffrey4l) wrote :

For ksm, the memcacheclientpool is not enabled in default. need add

[keystone_authtoken]
...
memcache_use_advanced_pool = true

After enabled this, ksw raised exact the same error message as bug description.

env: openstack ocata.

Changed in keystonemiddleware:
status: Invalid → New
Changed in keystonemiddleware:
assignee: nobody → Jeffrey Zhang (jeffrey4l)
status: New → In Progress
Revision history for this message
Lance Bragstad (lbragstad) wrote :

Automatically unassigning due to inactivity.

Changed in keystonemiddleware:
assignee: Jeffrey Zhang (jeffrey4l) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on keystonemiddleware (master)

Change abandoned by Jeffrey Zhang (<email address hidden>) on branch: master
Review: https://review.openstack.org/496972

Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

marking as invalid for ksm.

Changed in keystonemiddleware:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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