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 deadlock in fs_test.WALWriteRetryableErrorAutoRecover1 #7897

Closed
wants to merge 1 commit into from

Conversation

jay-zhuang
Copy link
Contributor

The recovery thread could hold the db.mutex, which is needed from sync
write in main thread.
Make sure the write is done before recovery thread starts.

Test Plan: gtest-parallel ./error_handler_fs_test --gtest_filter=DBErrorHandlingFSTest.WALWriteRetryableErrorAutoRecover1 -r 10000 --workers=200

The recovery thread could hold the db.mutex, which is needed from sync
write in main thread.
Make sure the write is done before recovery thread starts.

Test Plan: `gtest-parallel ./error_handler_fs_test --gtest_filter=DBErrorHandlingFSTest.WALWriteRetryableErrorAutoRecover1 -r 10000 --workers=200`
@jay-zhuang jay-zhuang linked an issue Jan 26, 2021 that may be closed by this pull request
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@jay-zhuang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@zhichao-cao zhichao-cao left a comment

Choose a reason for hiding this comment

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

So the case is, the recover thread hold the db_mutex, and is at RecoverFromRetryableBGIOError:BeforeResume0 wait for WALWriteError1:0. However, the main thread try to grab db_mutex for sync, so waiting at that location, which is ahead of WALWriteError1:0. Do I understand correctly?

@jay-zhuang
Copy link
Contributor Author

So the case is, the recover thread hold the db_mutex, and is at RecoverFromRetryableBGIOError:BeforeResume0 wait for WALWriteError1:0. However, the main thread try to grab db_mutex for sync, so waiting at that location, which is ahead of WALWriteError1:0. Do I understand correctly?

Yes exactly.

Copy link
Contributor

@zhichao-cao zhichao-cao 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 for the fix!

@facebook-github-bot
Copy link
Contributor

@jay-zhuang merged this pull request in c6ff4c0.

codingrhythm pushed a commit to SafetyCulture/rocksdb that referenced this pull request Mar 5, 2021
…k#7897)

Summary:
The recovery thread could hold the db.mutex, which is needed from sync
write in main thread.
Make sure the write is done before recovery thread starts.

Pull Request resolved: facebook#7897

Test Plan: `gtest-parallel ./error_handler_fs_test --gtest_filter=DBErrorHandlingFSTest.WALWriteRetryableErrorAutoRecover1 -r 10000 --workers=200`

Reviewed By: zhichao-cao

Differential Revision: D26082933

Pulled By: jay-zhuang

fbshipit-source-id: 226fc49228c0e5903f86ff45cc3fed3080abdb1f
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.

flaky test: error_handler_fs_test
3 participants