-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Correctly check for vm.overcommit_memory == 0 #10841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
redis-server should warn upon startup if the vm.overcommit_memory sysctl is set to 0, as this could have adverse effects under memory pressure. The value is parsed from an ASCII string retrieved from a file in /proc. 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 having occurred. Also, the check as implemented had its intended logic reversed, failing to warn for an actual value of 0, but emitting the warning in all other potential cases (vm.overcommit_memory is not a boolean value). Using strtol() instead of atoi() and comparing its return value to 0 should work.
|
looks like a regression caused by #10636 (released in 7.0.1). |
|
7.0.2 exhibits the same problem as 7.0.1: Please merge this trivial fix - iI've kept its diff minimal on purpose. |
|
@jtru I'm sorry. I messed up and cleared the label confusing it with the other issue. |
|
@jtru i edited the top comment for the purpose of release notes (and commit comment), please confirm it's OK. |
|
Sure thing, 100% fine with me :) Thanks for merging! |
To benefit from the fix (it is actually just cosmetic; the warning is spurious - redis will not change behavior in any other way than not displaying the warning when it is not warranted to do so) wait for the next release including it, and install/run that. Until then, you don't need to do anything other than ignore it, once you checked that your |
|
CPU overcommit is not the same as virtual memory overcommit. |
|
You right its a node, i see it now in the docs: |
A regression caused by redis#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.

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.
Behavior after fix (warns correctly):
Behavior as of 7.0.1 (bogus warning):