Fix: There is a concurrency problem with on_get_session

This commit is contained in:
obdev
2024-02-07 11:46:01 +00:00
committed by ob-robot
parent e60426a0b2
commit 90d25434c6

View File

@ -6471,6 +6471,7 @@ int ObExecEnv::store(ObBasicSessionInfo &session)
void ObBasicSessionInfo::on_get_session()
{
LockGuard lock_guard(thread_data_mutex_);
const char *str = lbt();
int len = STRLEN(str);
if (sess_bt_buff_pos_ + len + 2 < MAX_SESS_BT_BUFF_SIZE) {
@ -6488,6 +6489,7 @@ void ObBasicSessionInfo::on_get_session()
void ObBasicSessionInfo::on_revert_session()
{
LockGuard lock_guard(thread_data_mutex_);
int32_t v = ATOMIC_AAF(&sess_ref_cnt_, -1);
if (v <= 0) {
sess_bt_buff_pos_ = 0;