Fix incursive deadlock in ~Snapshot#2277
Merged
JaySon-Huang merged 3 commits intopingcap:masterfrom Jun 30, 2021
Merged
Conversation
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Contributor
Author
|
/run-all-tests |
Collaborator
|
cherry pick to release-4.0 in PR #2280 |
Collaborator
|
cherry pick to release-5.1 in PR #2281 |
JaySon-Huang
added a commit
that referenced
this pull request
Jun 30, 2021
JaySon-Huang
added a commit
to JaySon-Huang/tiflash
that referenced
this pull request
Jul 1, 2021
* Fix data race on bkg tasks * Fix incursive deadlock Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
LittleFall
pushed a commit
that referenced
this pull request
Jul 1, 2021
JaySon-Huang
pushed a commit
that referenced
this pull request
Jul 6, 2021
Contributor
Author
|
cherry pick to release-5.0 in PR #2274 |
ti-srebot
added a commit
that referenced
this pull request
Jul 15, 2021
This was referenced Jul 22, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: close #2249
Problem Summary:
Running
./dbms/src/Storages/Page/tests/page_stress_page_storage "" 120 8 1024, it will create 8 writing threads and 1024 reading threads.It will throw the same exception as #2249. The backtrace is[1].
We can see that inside
~Snapshot, it callsremoveExpiredSnapshotsand release another snapshot. It cause incursive deadlock onvset->read_write_mutex.#2229 Add some logic in
removeExpiredSnapshotsand make it more likely to run into this case.[1] backtrace
[2] https://github.com/pingcap/tics/blob/8a4e9a6745e540144201b12194f820dea3ea0f11/dbms/src/Storages/Page/mvcc/VersionSetWithDelta.h#L149-L154
What is changed and how it works?
vset->removeExpiredSnapshotsinside~Snapshot, only remove useless snapshot weak_ptrs inPageEntriesVersionSetWithDelta::listAllLiveFilesMergeDeltaTaskPool::length(a small data race fixing)Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
./dbms/src/Storages/Page/tests/page_stress_page_storage "" 120 8 1024, it won't throw error "Resource deadlock avoided"Side effects
Release note