-
Notifications
You must be signed in to change notification settings - Fork 411
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
disagg: Fix a potential crash when shutting down (#8848) #8914
disagg: Fix a potential crash when shutting down (#8848) #8914
Conversation
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-all-tests |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JaySon-Huang, JinheLin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
@ti-chi-bot: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests
If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This is an automated cherry-pick of #8848
What problem does this PR solve?
Issue Number: close #8837
Problem Summary:
There is a logging about "std::exception. Code: 1001, type: std::__1::system_error, e.what() = thread::join failed: Resource deadlock avoided". Usually it is caused by a thread is trying to call
join
for the thread itself.There is a chance that the task handle (shared_ptr) is being held by the background pool thread
tiflash/dbms/src/Storages/BackgroundProcessingPool.cpp
Lines 226 to 228 in 0d13f39
And the task handle could hold a shared_ptr to
UniversalPageStorageService
. So there could be a chance that:UniversalPageStorageService::shutdown
is calledremote_checkpoint_handle
, which contains a shared_ptr ofUniversalPageStorageService
UniversalPageStorageService
in theContextShared
is releasedremote_checkpoint_handle
, which cause the shared_ptr ofUniversalPageStorageService
being released. But the thread is created byUniversalPageStorageService::checkpoint_pool
. So the thread run into callingjoin
on itself and causing the system_errorWhat is changed and how it works?
Use a
weak_ptr
ofUniversalPageStorageService
instead ofshared_ptr
. So that even when theremote_checkpoint_handle
is still holding by the background pool thread, it won't cause the background pool thread callingjoin
on itself. Because the share counter ofUniversalPageStorageService
must go down to 0 outside of the background pool thread.Check List
Tests
Side effects
Documentation
Release note