Print mod_name while tenant memory leak detected
This commit is contained in:
@ -704,10 +704,12 @@ int ObMallocAllocator::recycle_tenant_allocator(uint64_t tenant_id)
|
|||||||
ObTenantCtxAllocator *ctx_allocator = tas[ctx_id];
|
ObTenantCtxAllocator *ctx_allocator = tas[ctx_id];
|
||||||
if (NULL == ctx_allocator) {
|
if (NULL == ctx_allocator) {
|
||||||
ctx_allocator = &ta[ctx_id];
|
ctx_allocator = &ta[ctx_id];
|
||||||
bool has_unfree = ctx_allocator->check_has_unfree();
|
char first_label[AOBJECT_LABEL_SIZE + 1] = {'\0'};
|
||||||
|
bool has_unfree = ctx_allocator->check_has_unfree(first_label);
|
||||||
if (has_unfree) {
|
if (has_unfree) {
|
||||||
LOG_ERROR("tenant memory leak!!!", K(tenant_id),
|
LOG_ERROR("tenant memory leak!!!", K(tenant_id), K(ctx_id),
|
||||||
K(ctx_id), "ctx_name", get_global_ctx_info().get_ctx_name(ctx_id));
|
"ctx_name", get_global_ctx_info().get_ctx_name(ctx_id),
|
||||||
|
"label", first_label);
|
||||||
tas[ctx_id] = ctx_allocator;
|
tas[ctx_id] = ctx_allocator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -167,7 +167,7 @@ public:
|
|||||||
int iter_label(VisitFunc func) const;
|
int iter_label(VisitFunc func) const;
|
||||||
int64_t sync_wash(int64_t wash_size);
|
int64_t sync_wash(int64_t wash_size);
|
||||||
int64_t sync_wash();
|
int64_t sync_wash();
|
||||||
bool check_has_unfree() { return obj_mgr_.check_has_unfree(); }
|
bool check_has_unfree(char *first_label) { return obj_mgr_.check_has_unfree(first_label); }
|
||||||
void update_wash_stat(int64_t related_chunks, int64_t blocks, int64_t size);
|
void update_wash_stat(int64_t related_chunks, int64_t blocks, int64_t size);
|
||||||
private:
|
private:
|
||||||
int64_t inc_ref_cnt(int64_t cnt) { return ATOMIC_FAA(&ref_cnt_, cnt); }
|
int64_t inc_ref_cnt(int64_t cnt) { return ATOMIC_FAA(&ref_cnt_, cnt); }
|
||||||
|
|||||||
6
deps/oblib/src/lib/alloc/object_mgr.cpp
vendored
6
deps/oblib/src/lib/alloc/object_mgr.cpp
vendored
@ -296,7 +296,7 @@ ObjectMgr::Stat ObjectMgr::get_stat()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::check_has_unfree()
|
bool ObjectMgr::check_has_unfree(char *first_label)
|
||||||
{
|
{
|
||||||
bool has_unfree = false;
|
bool has_unfree = false;
|
||||||
for (uint64_t idx = 0; idx < ATOMIC_LOAD(&sub_cnt_) && !has_unfree; idx++) {
|
for (uint64_t idx = 0; idx < ATOMIC_LOAD(&sub_cnt_) && !has_unfree; idx++) {
|
||||||
@ -304,7 +304,9 @@ bool ObjectMgr::check_has_unfree()
|
|||||||
if (OB_ISNULL(sub_mgr)) {
|
if (OB_ISNULL(sub_mgr)) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
has_unfree = sub_mgr->check_has_unfree();
|
sub_mgr->lock();
|
||||||
|
DEFER(sub_mgr->unlock());
|
||||||
|
has_unfree = sub_mgr->check_has_unfree(first_label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return has_unfree;
|
return has_unfree;
|
||||||
|
|||||||
11
deps/oblib/src/lib/alloc/object_mgr.h
vendored
11
deps/oblib/src/lib/alloc/object_mgr.h
vendored
@ -59,7 +59,14 @@ public:
|
|||||||
OB_INLINE int64_t get_hold() { return bs_.get_total_hold(); }
|
OB_INLINE int64_t get_hold() { return bs_.get_total_hold(); }
|
||||||
OB_INLINE int64_t get_payload() { return bs_.get_total_payload(); }
|
OB_INLINE int64_t get_payload() { return bs_.get_total_payload(); }
|
||||||
OB_INLINE int64_t get_used() { return bs_.get_total_used(); }
|
OB_INLINE int64_t get_used() { return bs_.get_total_used(); }
|
||||||
OB_INLINE bool check_has_unfree() { return bs_.check_has_unfree(); }
|
OB_INLINE bool check_has_unfree(char *first_label)
|
||||||
|
{
|
||||||
|
const bool has_unfree = bs_.check_has_unfree();
|
||||||
|
if (has_unfree) {
|
||||||
|
os_.check_has_unfree(first_label);
|
||||||
|
}
|
||||||
|
return has_unfree;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
#ifndef ENABLE_SANITY
|
#ifndef ENABLE_SANITY
|
||||||
lib::ObMutex mutex_;
|
lib::ObMutex mutex_;
|
||||||
@ -101,7 +108,7 @@ public:
|
|||||||
void print_usage() const;
|
void print_usage() const;
|
||||||
int64_t sync_wash(int64_t wash_size) override;
|
int64_t sync_wash(int64_t wash_size) override;
|
||||||
Stat get_stat();
|
Stat get_stat();
|
||||||
bool check_has_unfree();
|
bool check_has_unfree(char *first_label);
|
||||||
private:
|
private:
|
||||||
SubObjectMgr *create_sub_mgr();
|
SubObjectMgr *create_sub_mgr();
|
||||||
void destroy_sub_mgr(SubObjectMgr *sub_mgr);
|
void destroy_sub_mgr(SubObjectMgr *sub_mgr);
|
||||||
|
|||||||
11
deps/oblib/src/lib/alloc/object_set.cpp
vendored
11
deps/oblib/src/lib/alloc/object_set.cpp
vendored
@ -468,10 +468,9 @@ void ObjectSet::do_free_dirty_list()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectSet::check_has_unfree(const char **first_label)
|
bool ObjectSet::check_has_unfree(char *first_label)
|
||||||
{
|
{
|
||||||
bool has_unfree = false;
|
bool has_unfree = false;
|
||||||
if (first_label != NULL) *first_label = NULL;
|
|
||||||
|
|
||||||
if (blist_ != NULL) {
|
if (blist_ != NULL) {
|
||||||
ABlock *free_list_block = nullptr;
|
ABlock *free_list_block = nullptr;
|
||||||
@ -489,8 +488,8 @@ bool ObjectSet::check_has_unfree(const char **first_label)
|
|||||||
while (true) {
|
while (true) {
|
||||||
bool tmp_has_unfree = obj->in_use_;
|
bool tmp_has_unfree = obj->in_use_;
|
||||||
if (OB_UNLIKELY(tmp_has_unfree)) {
|
if (OB_UNLIKELY(tmp_has_unfree)) {
|
||||||
if (first_label != NULL) {
|
if ('\0' == first_label[0]) {
|
||||||
*first_label = *first_label ?:(char*)&obj->label_[0];
|
STRCPY(first_label, obj->label_);
|
||||||
}
|
}
|
||||||
if (!has_unfree) {
|
if (!has_unfree) {
|
||||||
has_unfree = true;
|
has_unfree = true;
|
||||||
@ -519,8 +518,8 @@ void ObjectSet::reset()
|
|||||||
const bool context_check = mem_context_ != nullptr;
|
const bool context_check = mem_context_ != nullptr;
|
||||||
const static int buf_len = 256;
|
const static int buf_len = 256;
|
||||||
char buf[buf_len] = {'\0'};
|
char buf[buf_len] = {'\0'};
|
||||||
const char *first_label = NULL;
|
char first_label[AOBJECT_LABEL_SIZE + 1] = {'\0'};
|
||||||
bool has_unfree = check_has_unfree(&first_label);
|
bool has_unfree = check_has_unfree(first_label);
|
||||||
if (has_unfree) {
|
if (has_unfree) {
|
||||||
if (context_check) {
|
if (context_check) {
|
||||||
const StaticInfo &static_info = mem_context_->get_static_info();
|
const StaticInfo &static_info = mem_context_->get_static_info();
|
||||||
|
|||||||
2
deps/oblib/src/lib/alloc/object_set.h
vendored
2
deps/oblib/src/lib/alloc/object_set.h
vendored
@ -69,6 +69,7 @@ public:
|
|||||||
inline int64_t get_normal_hold() const;
|
inline int64_t get_normal_hold() const;
|
||||||
inline int64_t get_normal_used() const;
|
inline int64_t get_normal_used() const;
|
||||||
inline int64_t get_normal_alloc() const;
|
inline int64_t get_normal_alloc() const;
|
||||||
|
bool check_has_unfree(char *first_label);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AObject *alloc_normal_object(const uint32_t cls, const ObMemAttr &attr);
|
AObject *alloc_normal_object(const uint32_t cls, const ObMemAttr &attr);
|
||||||
@ -91,7 +92,6 @@ private:
|
|||||||
|
|
||||||
void do_free_object(AObject *obj);
|
void do_free_object(AObject *obj);
|
||||||
void do_free_dirty_list();
|
void do_free_dirty_list();
|
||||||
bool check_has_unfree(const char **first_label=NULL);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
__MemoryContext__ *mem_context_;
|
__MemoryContext__ *mem_context_;
|
||||||
|
|||||||
Reference in New Issue
Block a user