python-memcached icon indicating copy to clipboard operation
python-memcached copied to clipboard

Flush on next connect flushes the entire Memcache server

Open sidprak opened this issue 5 years ago • 3 comments

It looks like setting flush on next connect executes a flush_all on the Memcache server on every reconnect. https://github.com/linsomniac/python-memcached/blob/master/memcache.py#L1413

This seems like a bug? Was the meaning of self.flush() misunderstood? I think we just want to flush the state from the connection and not expire all keys from the Memcache node.

sidprak avatar Dec 02 '20 21:12 sidprak

Hello,

I think we face a similar issue on Openstack since we updated our code to pass the flush_on_reconnect param. [1][2][3] It will trigger a flush_all [4][5].

If you have several clients doing flush_on_reconnect, connections to memcached is going rapidly UP. Because of this , memcached is extremly overkilled and process of flush is repeated again again, and connections are going UP and UP.

Please, can you tell us if this behavior is something expected or if this is a side effect that wasn't expected.

[1] https://bugs.launchpad.net/oslo.cache/+bug/1888394 [2] https://bugs.launchpad.net/keystonemiddleware/+bug/1883659 [3] https://bugs.launchpad.net/keystonemiddleware/+bug/1892852 [4] https://github.com/linsomniac/python-memcached/blob/master/memcache.py#L1388,L1389 [5] https://github.com/linsomniac/python-memcached/blob/master/memcache.py#L1413

4383 avatar Jan 14 '21 06:01 4383

I am fairly certain this is not expected and also don't expect it to be fixed given that this project is not being maintained. See #177 and #95

sidprak avatar Jan 14 '21 13:01 sidprak

@sidprak thanks for the heads up, I think you're right.

4383 avatar Jan 15 '21 10:01 4383