The documentation for BGREWRITEAOF states that BGREWRITEAOF always returns the string value OK.

Well, today I sent BGREWRITEAOF to my redis-server 2.6.7 and received (error) ERR in response.

maxmemory is 3G; appendonly is yes. The system has 4gb of RAM.

What happened?


The background thread responsible for rewriting the AOF ran out of memory. The log looked something like this, repeated every few hundred ms:

[2435] * Starting automatic rewriting of AOF on 302% growth
[2435] # Can't rewrite append only file in background: fork: Cannot allocate memory

Redis had gotten into a loop where the background thread was stuck, and BGREWRITEAOF was not able to start a new one. Restarting the Redis server was the way I corrected it, with a few seconds of downtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.