Grokzen / redis-py-cluster

Python cluster client for the official redis cluster. Redis 3.0+.
https://redis-py-cluster.readthedocs.io/
MIT License
1.1k stars 316 forks source link

KeyError:636 -> BaseException #503

Closed aman918raj closed 1 year ago

aman918raj commented 2 years ago

I am getting below error while using Redis clustered cache in Azure :

**BaseException Traceback (most recent call last): File "/home/site/wwwroot/.python_packages/lib/site-packages/rediscluster/client.py", line 609, in _execute_command node = self.connection_pool.get_node_by_slot( File "/home/site/wwwroot/.python_packages/lib/site-packages/rediscluster/connection.py", line 634, in get_node_by_slot nodes_in_slot = self.nodes.slots[slot] KeyError: 636

Result: Failure
Exception: AttributeError: 'NoneType' object has no attribute 'disconnect'
Stack: File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 406, in _handle__invocation_request
call_result = await self._loop.run_in_executor(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 648, in _run_sync_func
return ExtensionManager.get_sync_invocation_wrapper(context,
File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/extension.py", line 215, in _raw_invocation_wrapper
result = function(**args)
File "/home/site/wwwroot/fn_test_clustered_redis/__init__.py", line 51, in main
ClusterFeatureCache().write(key, value)
File "/home/site/wwwroot/fn_test_clustered_redis/__init__.py", line 38, in write
self._cache.set(id, value)
File "/home/site/wwwroot/.python_packages/lib/site-packages/redis/client.py", line 1801, in set
return self.execute_command('SET', *pieces)
File "/home/site/wwwroot/.python_packages/lib/site-packages/rediscluster/client.py", line 555, in execute_command
return self._execute_command(*args, **kwargs)
File "/home/site/wwwroot/.python_packages/lib/site-packages/rediscluster/client.py", line 713, in _execute_command
connection.disconnect()**
Grokzen commented 2 years ago

@aman918raj What redis-py-cluster version you running on? It looks like you are on an older version that used to have this kind of error? Otherwise you have some issue with shared state between threads where you got into a case where one thread already killed a connection and the other one wants to kill it. I think this should have been fixed in a later redis-py-cluster version tho

Grokzen commented 1 year ago

Closing due to inactivity. This is either an old client version, or the redis cluster itself is not working properly as the slots cache is not setup properly due to the cluster being i a bad or broken state, or maybe an unitialized state.