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

fix: crash if we OOM during migration process #3968

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Conversation

BorysTheDev
Copy link
Contributor

@BorysTheDev BorysTheDev commented Oct 23, 2024

problem: crash if add keys during OOM

I've faced this situation when investigating memory consumption increasing for cluster slot migration
maxmemory default value was 8GB and the test used 9GB. The crash happened for the target node during the migration process.

fix: check the iterator before accessing the data

Also, I've updated the test to reproduce this situation easily

async def test_cluster_memory_consumption_migration(df_factory: DflyInstanceFactory):
# Check data migration from one node to another
instances = [
df_factory.create(
maxmemory="15G",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

um CI is at best 6-7 gb of free space, if we plan to enable this test again we should take care of this. (no action needed now)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test isn't for CI, it's marked as skipped

auto res = db_slice.AddNew(cntx, key, std::move(pv), args.ExpirationTime());
res->it->first.SetSticky(args.Sticky());
if (res) {
if (auto res = db_slice.AddNew(cntx, key, std::move(pv), args.ExpirationTime()); res) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. My question here is why do Migrations use RdbRestoreValue::Add ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, it's according design to use RESTORE command

@BorysTheDev BorysTheDev merged commit c80d21f into main Oct 23, 2024
12 checks passed
@BorysTheDev BorysTheDev deleted the fix_crash_when_OOM branch October 23, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants