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

[wip] Add failing test case to spot an accountsDb corruption bug #7143

Closed
wants to merge 2 commits into from

Conversation

ryoqun
Copy link
Member

@ryoqun ryoqun commented Nov 26, 2019

Related to #7117.

If this is a real bug, this is scary. Basically, this corrupts the very integrity of AccountsDB.

The problem here is that a StorageEntry with a zero-lamport account data is prematurely/incorrectly flushed, and the account becomes non-zero balance again, namely the older version of account is restored, resulting in unexpected internal hash error.

(I've been concerned with these problems in my mind since the first draft of #7013, which resorted to bizarre solution because of this, this indeed seems to be a real issue, now)

@ryoqun ryoqun requested a review from sakridge November 26, 2019 10:00

current_slot += 1;
accounts.store(current_slot, &[(&pubkey, &zero_lamport_account)]);
for _ in 0..33000 {
Copy link
Member Author

Choose a reason for hiding this comment

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

If I reduce this number, this test passes...

let accounts = reconstruct_accounts_db_via_serialization(accounts, current_slot);

error!("does fail due to a reconstruction bug:");
assert_load_account(&accounts, current_slot, pubkey, zero_lamport);
Copy link
Member Author

@ryoqun ryoqun Nov 26, 2019

Choose a reason for hiding this comment

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

This should behave exactly same as this identical assertion.

Copy link
Member Author

Choose a reason for hiding this comment

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

This fails like this.

error!("doesn't fail:");
assert_load_account(&accounts, current_slot, pubkey, zero_lamport);

purge_zero_lamport_accounts(&accounts, current_slot);
Copy link
Member Author

Choose a reason for hiding this comment

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

If I remove this line, this test passes.

@mvines
Copy link
Member

mvines commented Nov 26, 2019

(@ryoqun - just a minor suggestion: it would be helpful if this PR title was a bit more descriptive. "Add failing test case to spot a bug": what bug? Perhaps "Add failing test case to spot an accountsDb corruption bug")

@ryoqun ryoqun changed the title [wip] Add failing test case to spot a bug [wip] Add failing test case to spot an accountsDb corruption bug Nov 26, 2019
@ryoqun
Copy link
Member Author

ryoqun commented Nov 26, 2019

(@ryoqun - just a minor suggestion: it would be helpful if this PR title was a bit more descriptive. "Add failing test case to spot a bug": what bug? Perhaps "Add failing test case to spot an accountsDb corruption bug")

Exactly agreeable. :) Rename done.

@ryoqun
Copy link
Member Author

ryoqun commented Dec 3, 2019

@ryoqun ryoqun closed this Dec 3, 2019
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