Skip to content

'ClusterPipeline' object has no attribute '_lock' #2189

Description

@grippy

Version: What redis-py and what redis version is the issue happening on?

4.3.1

Platform: What platform / version? (For example Python 3.5.1 on Windows 7 / Ubuntu 15.10 / Azure)

Python 3.10
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
AWS

Description:

This issue bubbles up as part of the retry magic if the cluster client receives a MOVED response...

      File "/myscript.py", line 110, in __set_redis_users
        multi.execute()
      File "/_venv/lib/python3.10/site-packages/redis/cluster.py", line 1852, in execute
        return self.send_cluster_commands(stack, raise_on_error)
      File "/_venv/lib/python3.10/site-packages/redis/cluster.py", line 1911, in send_cluster_commands
        return self._send_cluster_commands(
      File "/_venv/lib/python3.10/site-packages/redis/cluster.py", line 1958, in _send_cluster_commands
        redis_node = self.get_redis_connection(node[0])
      File "/_venv/lib/python3.10/site-packages/redis/cluster.py", line 647, in get_redis_connection
        with self._lock:
    AttributeError: 'ClusterPipeline' object has no attribute '_lock'

It looks like ClusterPipeline isn't initializing the RedisCluster base class to inherit the _lock?
https://github.com/redis/redis-py/blob/master/redis/cluster.py#L1747-L1778

Or, the _lock needs to be passed here:
https://github.com/redis/redis-py/blob/master/redis/cluster.py#L748-L757

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions