commit 38dcffa904c7d4b5bd61896b972c1e16477fcc56
Author: Ben Nemec <email address hidden>
Date: Tue Feb 26 22:12:23 2019 +0000
Fix memcache pool client in monkey-patched environments
First off, this is an ugly hack, but we're dealing with code that
essentially monkey-patches a monkey-patch. You reap what you sow.
Per the linked bug, our connection pool client explodes on python 3
with eventlet monkey-patching in force:
TypeError: object() takes no parameters
This is due to the way __new__ is overridden in the class. We need
to strip arguments from the call before they get to object(), which
doesn't accept args.
Unfortunately, when we're _not_ monkey-patched, adding the new
override implementation fails with:
TypeError: object.__new__(_MemcacheClient) is not safe,
use Client.__new__()
As such, we need different implementations depending on whether we
are monkey-patched or not. This change passes both with and without
monkey-patching and adds a unit test that exposes the bug.
Note that this is a temporary, backportable fix that will ultimately
be replaced by a switch to the pymemcache library which does not
have the threading.local problem being worked around here.
Change-Id: I039dffadeebd0ff4479b9c870c257772c43aba53
Partial-Bug: 1812935
Closes-Bug: 1812672
(cherry picked from commit f4a25f642991a7114b86f6eb7d0bac3d599953a6)
(cherry picked from commit caf5443de8ff4ff353d741a125f782c67f579f52)
Reviewed: https:/ /review. opendev. org/655468 /git.openstack. org/cgit/ openstack/ oslo.cache/ commit/ ?id=38dcffa904c 7d4b5bd61896b97 2c1e16477fcc56
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 38dcffa904c7d4b 5bd61896b972c1e 16477fcc56
Author: Ben Nemec <email address hidden>
Date: Tue Feb 26 22:12:23 2019 +0000
Fix memcache pool client in monkey-patched environments
First off, this is an ugly hack, but we're dealing with code that
essentially monkey-patches a monkey-patch. You reap what you sow.
Per the linked bug, our connection pool client explodes on python 3
with eventlet monkey-patching in force:
TypeError: object() takes no parameters
This is due to the way __new__ is overridden in the class. We need
to strip arguments from the call before they get to object(), which
doesn't accept args.
Unfortunately, when we're _not_ monkey-patched, adding the new
override implementation fails with:
TypeError: object. __new__ (_MemcacheClien t) is not safe,
use Client.__new__()
As such, we need different implementations depending on whether we
are monkey-patched or not. This change passes both with and without
monkey-patching and adds a unit test that exposes the bug.
Note that this is a temporary, backportable fix that will ultimately
be replaced by a switch to the pymemcache library which does not
have the threading.local problem being worked around here.
Change-Id: I039dffadeebd0f f4479b9c870c257 772c43aba53 14b86f6eb7d0bac 3d599953a6) 353d741a125f782 c67f579f52)
Partial-Bug: 1812935
Closes-Bug: 1812672
(cherry picked from commit f4a25f642991a71
(cherry picked from commit caf5443de8ff4ff