OOM command not allowed when used memory > 'maxmemory'.报错
作者:吴炳锡 来源:http://wubx.net/ 联系方式: wubingxi#163.com 转载请注明作/译者和出处,并且不能用于商业用途,违者必究.
OOM command not allowed when used memory > ‘maxmemory’ 报错排查
grep “OOM command not allowed when used memory > ‘maxmemory'” * -rsrc/redis.c: “-OOM command not allowed when used memory > ‘maxmemory’.\r\n”));
查看src/redis.c
shared.oomerr = createObject(REDIS_STRING,sdsnew(
"-OOM command not allowed when used memory > 'maxmemory'.\r\n"));
。。。
/* Handle the maxmemory directive.
*
* First we try to free some memory if possible (if there are volatile
* keys in the dataset). If there are not the only thing we can do
* is returning an error. */ if (server.maxmemory) { int retval = freeMemoryIfNeeded(); if ((c->cmd->flags & REDIS_CMD_DENYOOM) && retval == REDIS_ERR) {
flagTransaction(c);
addReply(c, shared.oomerr); return REDIS_OK;
}
}
shared . oomerr = createObject ( REDIS_STRING , sdsnew (
"-OOM command not allowed when used memory > 'maxmemory'.\r\n" ) ) ;
。。。
/* Handle the maxmemory directive.
*
* First we try to free some memory if possible (if there are volatile
* keys in the dataset). If there are not the only thing we can do
* is returning an error. */
if ( server . maxmemory ) {
int retval = freeMemoryIfNeeded ( ) ;
if ( ( c - & gt ; cmd - & gt ; flags & amp ; REDIS_CMD_DENYOOM ) & amp ; & amp ;retval == REDIS_ERR ) {
flagTransaction ( c ) ;
addReply ( c , shared . oomerr ) ;
return REDIS_OK ;
}
}
#python t_redis.py
Traceback (most recent calllast):
File "t_redis.py", line 21, in <module> start()
File "t_redis.py", line 15, instart
s = r.set(key, v1)
File "/usr/lib/python2.6/site-packages/redis/client.py", line 647, inset
return self.execute_command('SET', name, value)
File "/usr/lib/python2.6/site-packages/redis/client.py", line 330, in execute_command
**options
File "/usr/lib/python2.6/site-packages/redis/client.py", line 312, in _execute_command
return self.parse_response(command_name, **options)
File "/usr/lib/python2.6/site-packages/redis/client.py", line 390, in parse_response
response = self._parse_response(command_name, catch_errors)
File "/usr/lib/python2.6/site-packages/redis/client.py", line 349, in _parse_response
raise ResponseError(response)
redis.exceptions.ResponseError: OOM command not allowed when used memory > 'maxmemory'.
#python t_redis.py
Traceback ( most recent call last ) :
File "t_redis.py" , line 21 , in & lt ; module & gt ;
start ( )
File "t_redis.py" , line 15 , in start
s = r . set ( key , v1 )
File "/usr/lib/python2.6/site-packages/redis/client.py" , line 647 , in set
return self . execute_command ( 'SET' , name , value )
File "/usr/lib/python2.6/site-packages/redis/client.py" , line 330 , inexecute_command
* * options
File "/usr/lib/python2.6/site-packages/redis/client.py" , line 312 , in_execute_command
return self . parse_response ( command_name , * * options )
File "/usr/lib/python2.6/site-packages/redis/client.py" , line 390 , in parse_response
response = self . _parse_response ( command_name , catch_errors )
File "/usr/lib/python2.6/site-packages/redis/client.py" , line 349 , in _parse_response
raise ResponseError ( response )
redis . exceptions . ResponseError : OOM command not allowed when used memory& gt ; 'maxmemory' .