Unverified Commit 9f3b4100 authored by Johannes Truschnigg's avatar Johannes Truschnigg Committed by GitHub
Browse files

Correctly check for vm.overcommit_memory == 0 (#10841)

A regression caused by #10636 (released in 7.0.1) causes Redis startup warning about overcommit to be missing when needed and printed when not. 

Also, using atoi() to convert the string's value to an integer cannot discern
between an actual 0 (zero) having been read, or a conversion error. 
parent abb2ea7e
......@@ -150,7 +150,7 @@ int checkOvercommit(sds *error_msg) {
}
fclose(fp);
if (atoi(buf)) {
if (strtol(buf, NULL, 10) == 0) {
*error_msg = sdsnew(
"overcommit_memory is set to 0! Background save may fail under low memory condition. "
"To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment