公司产品用的老爷牌python2.4.4,redis版本2.4.5,简直了。
分配了个任务,需要用到redis当作消息队列,基本没接触过。
python的redis库连接redis后,get等方法能够正常获取数据,但是使用set或者其他方法存数据时,却抛出一个异常
File "build/bdist.linux-i686/egg/redis/connection.py", line 210, in read_response
File "build/bdist.linux-i686/egg/redis/connection.py", line 68, in read_response
redis.exceptions.InvalidResponse: Protocol Error
可能因为版本bug问题,公司服务器上查看的源码和pypi中的源码不一致,提供的异常信息非常有限,网上搜索的资料也无法提供有效帮助,很秃然。服务器是生产环境,不能乱动,将python库中的redis文件夹复制后对源码进行修改,将connection.py的68行对应异常函数的response通过raise输出,然后通过交互模式进行调试,raise的信息:
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors durying writes if RDB snapshotting fail (stop-writes-on-bgsave-error option). Please check Redis logs for details about the error.
此信息搜索的结果说有可能是内存爆了。
然后感觉查看服务器内存,确实是内存满了。
记录在此,方便以后查看,以后发现redis能取不能存,可以优先查看服务器内存是否被用尽。