xinyiZzz commented on code in PR #23578: URL: https://github.com/apache/doris/pull/23578#discussion_r1310063610
########## be/src/common/daemon.cpp: ########## @@ -187,9 +189,8 @@ void Daemon::memory_maintenance_thread() { int32_t interval_milliseconds = config::memory_maintenance_sleep_time_ms; int64_t last_print_proc_mem = PerfCounters::get_vm_rss(); while (!_stop_background_threads_latch.wait_for( - std::chrono::milliseconds(interval_milliseconds)) && - !k_doris_exit) { - if (!MemInfo::initialized() || !ExecEnv::GetInstance()->initialized()) { + std::chrono::milliseconds(interval_milliseconds))) { + if (!MemInfo::initialized() || !ExecEnv::ready()) { Review Comment: `daemon` starts after `MemInfo` and `ExecEnv`, are these judgments useless, or changed to Check? ########## be/src/runtime/thread_context.h: ########## @@ -238,7 +235,7 @@ class SwitchBthreadLocal { // The brpc server should respond as quickly as possible. bthread_context->thread_mem_tracker_mgr->disable_wait_gc(); // set the data so that next time bthread_getspecific in the thread returns the data. - CHECK((0 == bthread_setspecific(btls_key, bthread_context)) || doris::k_doris_exit); + CHECK((0 == bthread_setspecific(btls_key, bthread_context))); Review Comment: This `doris::k_doris_exit` seems to be necessary, `bthread_setspecific` will fail in the process of brpc server stop ########## be/src/common/daemon.cpp: ########## @@ -356,146 +354,59 @@ void Daemon::calculate_metrics_thread() { DorisMetrics::instance()->all_segments_num->set_value( StorageEngine::instance()->tablet_manager()->get_segment_nums()); } - } while (!_stop_background_threads_latch.wait_for(std::chrono::seconds(15)) && !k_doris_exit); Review Comment: In the past `daemon.stop` is also before `ExecEnv::destroy`, but when BE grace exit will be wrong: https://github.com/apache/doris/pull/22560 I'm not sure if there is still a problem. ########## be/src/service/doris_main.cpp: ########## @@ -515,7 +570,7 @@ int main(int argc, char** argv) { // 4. heart beat server doris::TMasterInfo* master_info = exec_env->master_info(); - doris::ThriftServer* heartbeat_thrift_server; + std::unique_ptr<doris::ThriftServer> heartbeat_thrift_server; Review Comment: `sleep(10);` below should be changed to `sleep(1);`, in the past there were some other operations in `while (!doris::k_doris_exit) {`, but now there are no more. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org