Fix illegal memory reference problem
This commit is contained in:
parent
0713bad3c7
commit
46faad3ae7
6
deps/oblib/src/lib/ob_define.h
vendored
6
deps/oblib/src/lib/ob_define.h
vendored
@ -2457,10 +2457,10 @@ OB_INLINE char* ob_get_tname()
|
||||
return tname;
|
||||
}
|
||||
|
||||
OB_INLINE const char*& ob_get_origin_thread_name()
|
||||
OB_INLINE char* ob_get_origin_thread_name()
|
||||
{
|
||||
thread_local const char* tname = nullptr;
|
||||
return tname;
|
||||
thread_local char ori_tname[oceanbase::OB_THREAD_NAME_BUF_LEN] = {0};
|
||||
return ori_tname;
|
||||
}
|
||||
|
||||
static const char* PARALLEL_DDL_THREAD_NAME = "DDLPQueueTh";
|
||||
|
6
deps/oblib/src/lib/thread/ob_thread_name.h
vendored
6
deps/oblib/src/lib/thread/ob_thread_name.h
vendored
@ -32,7 +32,8 @@ inline void set_thread_name(const char* type, uint64_t idx)
|
||||
{
|
||||
char *name = ob_get_tname();
|
||||
uint64_t tenant_id = ob_get_tenant_id();
|
||||
ob_get_origin_thread_name() = type;
|
||||
char *ori_tname = ob_get_origin_thread_name();
|
||||
STRNCPY(ori_tname, type, oceanbase::OB_THREAD_NAME_BUF_LEN);
|
||||
if (tenant_id == 0) {
|
||||
snprintf(name, OB_THREAD_NAME_BUF_LEN, "%s%ld", type, idx);
|
||||
} else {
|
||||
@ -45,7 +46,8 @@ inline void set_thread_name(const char* type)
|
||||
{
|
||||
char *name = ob_get_tname();
|
||||
uint64_t tenant_id = ob_get_tenant_id();
|
||||
ob_get_origin_thread_name() = type;
|
||||
char *ori_tname = ob_get_origin_thread_name();
|
||||
STRNCPY(ori_tname, type, oceanbase::OB_THREAD_NAME_BUF_LEN);
|
||||
if (tenant_id == 0) {
|
||||
snprintf(name, OB_THREAD_NAME_BUF_LEN, "%s", type);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user