Skip to content

python-cache suggests using pylibmc in a way that is not threadsafe #3

@jwmerrill

Description

@jwmerrill

See pylibmc's documentation on pooling:

http://sendapatch.se/projects/pylibmc/pooling.html

A single pylibmc client can not be used concurrently by different threads. It's common for python web frameworks and web servers to use several threads to respond to incoming requests, so following python-cache's usage example makes it very easy to create invalid concurrent operations.

Beaker deals with this by using a ThreadMappedPool:

https://github.com/bbangert/beaker/blob/95cf84aff9242a86fdfced1cf9747bbe6fdc4029/beaker/ext/memcached.py#L179

It might be best for python-cache to take a pool (maybe a ThreadMappedPool, but a ClientPool might be preferable, see the pooling docs) instead of taking a client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions