Skip to content
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

[BUG] Write stall caused by setting maxmemory value lower than current used memory #1330

Open
xingbowang opened this issue Nov 20, 2024 · 5 comments

Comments

@xingbowang
Copy link

Describe the bug

When user set a new maxmemory value through config set command, engine just accept it without checking its current used memory and eviction policy. If engine has eviction turned off, this configuration change would immediately cause write outage. We could add a protection in updateMaxmemory function in config.c to reject new maxmemory value, if it is lower than usedmemory when eviction is turned off.

To reproduce

  1. Start an engine with eviction policy noeviction.
  2. Add 1MB data, to raise used memory to 1MB.
  3. Set maxmemory value to 100KB using config set.
  4. engine start to reject all write command.

Expected behavior

Engine would reject the config set command.

Additional information

@hpatro
Copy link
Contributor

hpatro commented Nov 20, 2024

Does this mean a user can't perform delete of keys as well? If that's the case, we should deny on the condition mentioned above.

@xingbowang
Copy link
Author

User can delete to get out of OOM, but operator would only discover that a while later, which would already cause production impact.

@hwware
Copy link
Member

hwware commented Nov 21, 2024

Does this mean a user can't perform delete of keys as well? If that's the case, we should deny on the condition mentioned above.

del command works

@hwware
Copy link
Member

hwware commented Nov 21, 2024

I think this is a normal behavior. User should take care of this situation and should remove some keys to decrease the used memory.

@madolson
Copy link
Member

Yeah, this does kind of feel like intended and expected behavior. We generally only reject config commands that are malformed for some reason. Even in AWS we don't like rejecting config commands because it breaks our internal config system sometimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants