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.
This commit is contained in:
+1
-1
@@ -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 "
|
||||
|
||||
Reference in New Issue
Block a user