[OBCDC] Fix coredump in lob_merger caused by used_after_free

This commit is contained in:
SanmuWangZJU
2024-07-03 15:12:02 +00:00
committed by ob-robot
parent 06c801bdd5
commit 2ece3d3782
3 changed files with 16 additions and 6 deletions

View File

@ -178,11 +178,12 @@ int ObCDCLobDataMerger::push_task_(
ObLobDataGetCtxList &lob_data_get_ctx_list = task.get_lob_data_get_ctx_list(); ObLobDataGetCtxList &lob_data_get_ctx_list = task.get_lob_data_get_ctx_list();
ObLobDataGetCtx *cur_lob_data_get_ctx = lob_data_get_ctx_list.head_; ObLobDataGetCtx *cur_lob_data_get_ctx = lob_data_get_ctx_list.head_;
while (OB_SUCC(ret) && ! is_in_stop_status(stop_flag) && cur_lob_data_get_ctx) { while (OB_SUCC(ret) && ! is_in_stop_status(stop_flag) && OB_NOT_NULL(cur_lob_data_get_ctx)) {
ObLobDataGetCtx *next_lob_data_get_ctx = cur_lob_data_get_ctx->get_next();
if (OB_FAIL(push_lob_column_(allocator, task, *cur_lob_data_get_ctx, stop_flag))) { if (OB_FAIL(push_lob_column_(allocator, task, *cur_lob_data_get_ctx, stop_flag))) {
LOG_ERROR("push_lob_column_ failed", KR(ret)); LOG_ERROR("push_lob_column_ failed", KR(ret));
} else { } else {
cur_lob_data_get_ctx = cur_lob_data_get_ctx->get_next(); cur_lob_data_get_ctx = next_lob_data_get_ctx;
} }
} }
@ -372,9 +373,10 @@ int ObCDCLobDataMerger::push_lob_col_fra_ctx_list_(
if (lob_col_fra_ctx_list.num_ <= 0) { if (lob_col_fra_ctx_list.num_ <= 0) {
// do nothing // do nothing
} else { } else {
while (OB_SUCC(ret) && ! is_in_stop_status(stop_flag) && cur_lob_col_fragment_ctx) { while (OB_SUCC(ret) && ! is_in_stop_status(stop_flag) && OB_NOT_NULL(cur_lob_col_fragment_ctx)) {
uint64_t hash_value = ATOMIC_FAA(&round_value_, 1); uint64_t hash_value = ATOMIC_FAA(&round_value_, 1);
void *push_task = static_cast<void *>(cur_lob_col_fragment_ctx); void *push_task = static_cast<void *>(cur_lob_col_fragment_ctx);
LobColumnFragmentCtx *next_lob_col_fragment_ct = cur_lob_col_fragment_ctx->get_next();
ret = OB_TIMEOUT; ret = OB_TIMEOUT;
while (OB_TIMEOUT == ret && ! is_in_stop_status(stop_flag)) { while (OB_TIMEOUT == ret && ! is_in_stop_status(stop_flag)) {
@ -386,9 +388,13 @@ int ObCDCLobDataMerger::push_lob_col_fra_ctx_list_(
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
cur_lob_col_fragment_ctx = cur_lob_col_fragment_ctx->get_next(); cur_lob_col_fragment_ctx = next_lob_col_fragment_ct;
} }
} }
if (is_in_stop_status(stop_flag)) {
ret = OB_IN_STOP_STATE;
}
} }
return ret; return ret;

View File

@ -453,7 +453,8 @@ int ObLogInstance::init_logger_()
_LOG_INFO("BUILD_VERSION: %s", build_version()); _LOG_INFO("BUILD_VERSION: %s", build_version());
_LOG_INFO("BUILD_TIME: %s %s", build_date(), build_time()); _LOG_INFO("BUILD_TIME: %s %s", build_date(), build_time());
_LOG_INFO("BUILD_FLAGS: %s%s", build_flags(), extra_flags); _LOG_INFO("BUILD_FLAGS: %s%s", build_flags(), extra_flags);
_LOG_INFO("Copyright (c) 2022 Ant Group Co., Ltd."); _LOG_INFO("BUILD_INFO: %s", build_info());
_LOG_INFO("Copyright (c) 2024 Ant Group Co., Ltd.");
_LOG_INFO("======================================================"); _LOG_INFO("======================================================");
_LOG_INFO("\n"); _LOG_INFO("\n");
} }
@ -474,7 +475,8 @@ void ObLogInstance::print_version()
MPRINT("REVISION: %s", build_version()); MPRINT("REVISION: %s", build_version());
MPRINT("BUILD_TIME: %s %s", build_date(), build_time()); MPRINT("BUILD_TIME: %s %s", build_date(), build_time());
MPRINT("BUILD_FLAGS: %s%s\n", build_flags(), extra_flags); MPRINT("BUILD_FLAGS: %s%s\n", build_flags(), extra_flags);
MPRINT("Copyright (c) 2022 Ant Group Co., Ltd."); MPRINT("BUILD_INFO: %s\n", build_info());
MPRINT("Copyright (c) 2024 Ant Group Co., Ltd.");
MPRINT(); MPRINT();
} }

View File

@ -22,6 +22,7 @@ const char* build_version();
const char* build_date(); const char* build_date();
const char* build_time(); const char* build_time();
const char* build_flags(); const char* build_flags();
const char* build_info();
int so_main() int so_main()
{ {
@ -38,6 +39,7 @@ int so_main()
fprintf(stdout, "BUILD_VERSION: %s\n", build_version()); fprintf(stdout, "BUILD_VERSION: %s\n", build_version());
fprintf(stdout, "BUILD_TIME: %s %s\n", build_date(), build_time()); fprintf(stdout, "BUILD_TIME: %s %s\n", build_date(), build_time());
fprintf(stdout, "BUILD_FLAGS: %s%s\n", build_flags(), extra_flags); fprintf(stdout, "BUILD_FLAGS: %s%s\n", build_flags(), extra_flags);
fprintf(stdout, "BUILD_INFO: %s\n", build_info());
exit(0); exit(0);
} }