libc memory leak of PL does not output ERROR log

This commit is contained in:
obdev
2023-07-24 02:48:34 +00:00
committed by ob-robot
parent b5d9eab1a9
commit 86fa74323f
3 changed files with 13 additions and 3 deletions

View File

@ -61,6 +61,7 @@ void *ob_malloc_retry(size_t size)
do {
ObMemAttr attr = ObMallocHookAttrGuard::get_tl_mem_attr();
SET_USE_500(attr);
attr.ctx_id_ = ObCtxIds::GLIBC;
ptr = ob_malloc(size, attr);
if (OB_ISNULL(ptr)) {
attr.tenant_id_ = OB_SERVER_TENANT_ID;

View File

@ -739,9 +739,17 @@ int ObMallocAllocator::recycle_tenant_allocator(uint64_t tenant_id)
char first_label[AOBJECT_LABEL_SIZE + 1] = {'\0'};
bool has_unfree = ctx_allocator->check_has_unfree(first_label);
if (has_unfree) {
if (ObCtxIds::GLIBC == ctx_id
&& 0 == strncmp("Pl", first_label, 2)
&& pl_leaked_times_++ < 10) {
LOG_WARN("tenant memory leak!!!", K(tenant_id), K(ctx_id),
"ctx_name", get_global_ctx_info().get_ctx_name(ctx_id),
"label", first_label);
} else {
LOG_ERROR("tenant memory leak!!!", K(tenant_id), K(ctx_id),
"ctx_name", get_global_ctx_info().get_ctx_name(ctx_id),
"label", first_label);
}
tas[ctx_id] = ctx_allocator;
}
}

View File

@ -160,6 +160,7 @@ public:
#endif
public:
bool force_explict_500_malloc_ = false;
bool pl_leaked_times_ = 0;
private:
DISALLOW_COPY_AND_ASSIGN(ObMallocAllocator);
class BucketLock