[BUG] fix be exit core when background thread access heap-after-free#5214
Closed
stdpain wants to merge 1 commit intoapache:masterfrom
Closed
[BUG] fix be exit core when background thread access heap-after-free#5214stdpain wants to merge 1 commit intoapache:masterfrom
stdpain wants to merge 1 commit intoapache:masterfrom
Conversation
HappenLee
reviewed
Jan 10, 2021
| RETURN_IF_ERROR(Thread::create( | ||
| "StorageEngine", "unused_rowset_monitor_thread", | ||
| [this]() { this->_unused_rowset_monitor_thread_callback(); }, | ||
| [this]() { this->shared_from_this()->_unused_rowset_monitor_thread_callback(); }, |
Contributor
There was a problem hiding this comment.
Maybe we should not pass this, but the shared_ptr of storage engine
HappenLee
reviewed
Jan 10, 2021
| std::unique_ptr<SystemMetrics> _system_metrics; | ||
|
|
||
| std::shared_ptr<MetricEntity> _server_metric_entity; | ||
|
|
Contributor
There was a problem hiding this comment.
no need add necessary space
HappenLee
requested changes
Jan 10, 2021
Contributor
HappenLee
left a comment
There was a problem hiding this comment.
There are some tiny code may need change
acelyc111
reviewed
Jan 11, 2021
|
|
||
| // background threads is detached thread, but they will depend on 'this' pointer. | ||
| // so we should pass a shared_from_this ptr to make sure that the pointer is not destroyed | ||
| // before the thread exits |
Member
There was a problem hiding this comment.
In my opinion, we should ensure all threads stoped before destrory the StorageEngine instance, use smart pointer is a compromised way to resolve this problem. There is no reason to keep any thread running after StorageEngine stoped in main function.
Hastyshell
pushed a commit
to Hastyshell/doris
that referenced
this pull request
Nov 12, 2025
…he#55936) (apache#5214) close apache#4875 --------- Co-authored-by: shee <13843187+qzsee@users.noreply.github.com> Co-authored-by: garenshi <garenshi@tencnet.com>
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.
Proposed changes
will close #5213
Types of changes
What types of changes does your code introduce to Doris?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.I have use shared_ptr to solve the problem of release dependency