Skip to content

Conversation

@cbi42
Copy link
Contributor

@cbi42 cbi42 commented Sep 26, 2022

Summary: when a new internal iterator is constructed during iterator refresh, pointer to the previous memtable range tombstone iterator was not cleared. This could cause segfault for future Refresh() calls when they try to free the memtable range tombstones. This PR fixes this issue.

Test plan: added a unit test in db_range_del_test.cc to reproduce this issue.

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @cbi42 for the fix.
Maybe note that in order to reproduce, ASAN build is needed?

@cbi42
Copy link
Contributor Author

cbi42 commented Sep 26, 2022

LGTM. Thanks @cbi42 for the fix. Maybe note that in order to reproduce, ASAN build is needed?

Thanks for the review. ASAN build is not needed for repro since it was a double free bug.

@riversand963
Copy link
Contributor

ASAN build is not needed for repro since it was a double free bug

Oh, I thought some allocators may not necessarily fail, but never mind. :)

@facebook-github-bot
Copy link
Contributor

@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@cbi42 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

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

LGTM too

@facebook-github-bot
Copy link
Contributor

@cbi42 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@cbi42 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@cbi42 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

cbi42 added a commit that referenced this pull request Sep 27, 2022
Summary:
when a new internal iterator is constructed during iterator refresh, pointer to the previous memtable range tombstone iterator was not cleared. This could cause segfault for future `Refresh()` calls when they try to free the memtable range tombstones. This PR fixes this issue.

Pull Request resolved: #10739

Test Plan: added a unit test in db_range_del_test.cc to reproduce this issue.

Reviewed By: ajkr, riversand963

Differential Revision: D39825283

Pulled By: cbi42

fbshipit-source-id: 3b59a2b73865aed39e28cdd5c1b57eed7991b94c
facebook-github-bot pushed a commit that referenced this pull request Oct 3, 2022
Summary:
added calls to `Iterator::Refresh()` in `NonBatchedOpsStressTest::TestIterateAgainstExpected()`. The testing key range is locked in `TestIterateAgainstExpected` so I do not expect this change to provide thorough stress test to `Iterator::Refresh()`. However, it can still be helpful for catching bugs like #10739. Will add calls to refresh in `TestIterate` once we support iterator refresh with snapshots.

Pull Request resolved: #10766

Test Plan: `python3 tools/db_crashtest.py whitebox --simple --verify_iterator_with_expected_state_one_in=2`

Reviewed By: ajkr

Differential Revision: D40008320

Pulled By: ajkr

fbshipit-source-id: cec93b07f915ef6476d41c1fee9b23c115188085
@hangc0276
Copy link

Hi @ajkr @riversand963 , does this PR can be cherry-picked to branch 6.29.fb?

@cbi42
Copy link
Contributor Author

cbi42 commented Jan 13, 2023

Hi @ajkr @riversand963 , does this PR can be cherry-picked to branch 6.29.fb?

The bug this PR fixed was introduced in 7.7, it may not apply to 6.29.fb.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants