Skip to content

Fix oom-score-adj-values range, abs options, and bug when used in config file#8046

Merged
oranagra merged 2 commits intoredis:unstablefrom
oranagra:fix_oom_adj_values
Nov 22, 2020
Merged

Fix oom-score-adj-values range, abs options, and bug when used in config file#8046
oranagra merged 2 commits intoredis:unstablefrom
oranagra:fix_oom_adj_values

Conversation

@oranagra
Copy link
Member

@oranagra oranagra commented Nov 12, 2020

When oom-score-adj-values is provided in the config file after
oom-score-adj yes, it'll take an immediate action, before
readOOMScoreAdj was acquired, resulting in an error (out of range score
due to uninitialized value. delay the reaction the real call is made by
main().

since the values are clamped to -1000..1000, and they're
applied as an offset from the value at startup (which may be -1000), we
need to allow the offsets to reach to +2000 so that a value of +1000 is
achievable in case the value at startup was -1000.

@oranagra oranagra requested a review from yossigo November 12, 2020 14:16
When oom-score-adj-values is provided in the config file after
oom-score-adj yes, it'll take an immediate action, before
readOOMScoreAdj was acquired, resulting in an error (out of range score
due to uninitialized value. delay the reaction the real call is made by
main().

since the values are clamped by the OS to -1000..1000, and they're
applied as an offset from the value at startup (which may be -1000), we
need to allow the offsets to reach to +2000 so that a value of +1000 is
achievable in case the value at startup was -1000.
@yossigo
Copy link
Collaborator

yossigo commented Nov 14, 2020

@oranagra It makes sense but it may not be intuitive. Do you think it may perhaps make more sense to make it possible to indicate absolute vs relative values?

@oranagra
Copy link
Member Author

@yossigo you mean a 3rd config that controls absolute vs relative?
I guess it make sense, since some people will grant privileges so that redis can set whatever it wants.
So the relative mode is mainly intended for those who don't...
Want me to add that to this PR?
Note that even if we add the absolute values feature, I still think the changes in this PR are necessary.

@yossigo
Copy link
Collaborator

yossigo commented Nov 15, 2020

@oranagra Why do you think it's necessary if there's a way to set absolute values?

@oranagra
Copy link
Member Author

@yossigo first, there'a a bugfix in this PR (not to call setOOMScoreAdj from the config parsing before reading the base value).

secondly, if you do allow a relative offset (both positive and negative offset), it's range should be large enough to cover the entire range.

@oranagra
Copy link
Member Author

@yossigo please have a look at the second commit.

@oranagra oranagra changed the title Fix oom-score-adj-values limits and bug when used in config file Fix oom-score-adj-values range, abs options, and bug when used in config file Nov 22, 2020
@oranagra oranagra merged commit 6195495 into redis:unstable Nov 22, 2020
@oranagra oranagra deleted the fix_oom_adj_values branch November 22, 2020 11:57
@oranagra
Copy link
Member Author

@redis/core-team sorry, i just realized a merged a change to the config options without a consensus.
please review and respond if you see an issue.
the change is that oom-score-adj is no longer a yes/no option, it now has absolute and relative too.

@itamarhaber
Copy link
Member

No objections, but adding the 'release notes' label so we don't forget to mention it for upgraders.

@itamarhaber itamarhaber added the release-notes indication that this issue needs to be mentioned in the release notes label Nov 22, 2020
@oranagra oranagra mentioned this pull request Jan 11, 2021
oranagra added a commit that referenced this pull request Jan 12, 2021
…fig file (#8046)

Fix: When oom-score-adj-values is provided in the config file after
oom-score-adj yes, it'll take an immediate action, before
readOOMScoreAdj was acquired, resulting in an error (out of range score
due to uninitialized value. delay the reaction the real call is made by
main().

Since the values are clamped to -1000..1000, and they're
applied as an offset from the value at startup (which may be -1000), we
need to allow the offsets to reach to +2000 so that a value of +1000 is
achievable in case the value at startup was -1000.

Adding an option for absolute values rather than relative ones.

(cherry picked from commit 6195495)
@oranagra oranagra mentioned this pull request Jan 13, 2021
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Mar 2, 2021
…fig file (redis#8046)

Fix: When oom-score-adj-values is provided in the config file after
oom-score-adj yes, it'll take an immediate action, before
readOOMScoreAdj was acquired, resulting in an error (out of range score
due to uninitialized value. delay the reaction the real call is made by
main().

Since the values are clamped to -1000..1000, and they're
applied as an offset from the value at startup (which may be -1000), we
need to allow the offsets to reach to +2000 so that a value of +1000 is
achievable in case the value at startup was -1000.

Adding an option for absolute values rather than relative ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants