How can BGREWRITEAOF return ERR?

1

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?

Jacob Krall

Posted 2017-11-21T00:26:41.467

Reputation: 207

Answers

1

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.

Jacob Krall

Posted 2017-11-21T00:26:41.467

Reputation: 207