Skip to content

Conversation

@stdpain
Copy link
Contributor

@stdpain stdpain commented Jan 9, 2021

Proposed changes

will close #5213

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] Documentation Update (if none of the other choices apply)
  • Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in 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 create an issue on (Fix #ISSUE), and have described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • [] If this change need a document change, I have updated the document
  • Any dependent changes have been merged

I have use shared_ptr to solve the problem of release dependency

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(); },
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should not pass this, but the shared_ptr of storage engine

std::unique_ptr<SystemMetrics> _system_metrics;

std::shared_ptr<MetricEntity> _server_metric_entity;

Copy link
Contributor

Choose a reason for hiding this comment

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

no need add necessary space

Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

There are some tiny code may need change


// 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
Copy link
Member

Choose a reason for hiding this comment

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

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.

@stdpain stdpain closed this Jan 11, 2021
@stdpain stdpain deleted the fix_be_exit_core branch February 23, 2021 10:44
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] BE may probabilistic trigger segmentfault when BE exit

3 participants