Skip to content

Commit

Permalink
Use DBUG_TRACE instead of DBUG_ENTER
Browse files Browse the repository at this point in the history
Summary:
several testcase failed in asan debug,

==106552==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7f38f3590078 at pc 0x0000093aa495 bp 0x7f38f358ffc0 sp 0x7f38f358ffb8
READ of size 4 at 0x7f38f3590078 thread T203
    #0 0x93aa494 in _db_enter_(char const*, int, char const*, unsigned int, _db_stack_frame_*)
    #1 0x8d0b9bb in Relay_log_info::remove_logged_gtids
    #2 0x8b1ec3f in trim_logged_gtid
    #3 0x8c767cf in process_raft_queue

If Use DBUG_ENTER, then you need to use DBUG_RETURN to pop current frame in CODE_STATE.
If use DBUG_TRACE, it will pop current frame during .dtor

ps. small refactor changes for sql/rpl_handler.cc

Reviewed By: bhatvinay

Differential Revision: D28809418

fbshipit-source-id: db2ac9c92f8
  • Loading branch information
luqun authored and inikep committed Oct 22, 2021
1 parent 3038fa2 commit 8810b86
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sql/rpl_gtid_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ enum_return_status Gtid_state::ensure_commit_group_sidnos(rpl_sidno sidno) {

enum_return_status Gtid_state::remove_logged_gtid_on_trim(
const std::vector<std::string> &trimmed_gtids) {
DBUG_ENTER("Gtid_state::remove_logged_gtid_on_trim");
DBUG_TRACE;
global_sid_lock->assert_some_lock();

if (trimmed_gtids.empty()) RETURN_OK;
Expand Down
7 changes: 2 additions & 5 deletions sql/rpl_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1692,18 +1692,15 @@ static int set_durability(
}

extern "C" void *process_raft_queue(void *) {
THD *thd;
bool thd_added = false;

Global_THD_manager *thd_manager = Global_THD_manager::get_instance();
/* Setup this thread */
my_thread_init();
thd = new THD;
THD *thd = new THD;
thd->thread_stack = (char *)&thd;
thd->store_globals();
// thd->thr_create_utime = thd->start_utime = my_micro_time();
thd->m_security_ctx->skip_grants();

thd->security_context()->skip_grants();
thd->set_new_thread_id();
thd_manager->add_thd(thd);
thd_added = true;
Expand Down
2 changes: 1 addition & 1 deletion sql/rpl_rli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,7 @@ int Relay_log_info::rli_init_info(bool skip_received_gtid_set_recovery) {

int Relay_log_info::remove_logged_gtids(
const std::vector<std::string> &trimmed_gtids) {
DBUG_ENTER("Relay_log_info::remove_logged_gtid");
DBUG_TRACE;
global_sid_lock->assert_some_lock();

if (trimmed_gtids.empty()) RETURN_OK;
Expand Down

0 comments on commit 8810b86

Please sign in to comment.