libc memory leak of PL does not output ERROR log
This commit is contained in:
1
deps/oblib/src/lib/alloc/malloc_hook.cpp
vendored
1
deps/oblib/src/lib/alloc/malloc_hook.cpp
vendored
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user