Search code examples
python-3.xgoogle-cloud-platformredisgoogle-cloud-memorystore

Redis Connection reset by peer when an object is greater than 1024kb


Context:

  • Google Cloud
  • Redis 6.x
  • Client: Python 3.7, redis==4.4.0
  • Python client error message: (104, 'Connection reset by peer')

A process has been working seamlessly until the Redis service got restarted today. After that, I cannot write any object to the managed Redis which is greater than 1024 kB. Anything smaller works fine.

I tried to check pages like https://cloud.google.com/memorystore/docs/redis/supported-redis-configurations for advice, but I could not find anything specific.

Any ideas?


Solution

  • Connection reset by peer typically means when a connection becomes disconnected, the next command issued on that connection will fail and redis-py will raise a ConnectionError to the caller. It is possible that the server is experiencing issues, or that there is a problem with the network connection between the client and the server when restarting the instance.

    It is possible to change the limit at runtime using the CONFIG SET command or in a permanent way using the Redis configuration file redis.conf.You can refer to this documentation for more information

    Using health_check_interval eliminated most of these Connection reset by peer errors

    You can also check this github thread1 & thread2