Closed pdillinger closed 3 months ago
@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@pdillinger has updated the pull request. You must reimport the pull request before landing.
@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@pdillinger merged this pull request in facebook/rocksdb@21eb82ebec503ab9fa9b2d9f36e3c332920f8274.
Summary: Crash test showed a potential use-after-free where a file marked as obsolete and eligible for uncache on destruction is destroyed in the VersionSet destructor, which only happens as part of DB shutdown. At that point, the in-memory column families have already been destroyed, so attempting to uncache could use-after-free on stuff like getting the
user_comparator()
from theinternal_comparator()
.I attempted to make it smarter, but wasn't able to untangle the destruction dependencies in a way that was safe, understandable, and maintainable.
Test Plan: Reproduced by adding uncache_aggressiveness to an existing (but otherwise unrelated) test. This makes it a fair regression test.
Also added testing to ensure that trivial moves and DB close & reopen are well behaved with uncache_aggressiveness. Specifically, this issue doesn't seem to be because things are uncached inappropriately in those cases.